This brings back memories! I discovered the same thing in high school in a programming class. We had a speed-golfing assignment and in the end my program ended up quite a bit faster than the "golden reference" our teacher had. He refused to believe I had come up with it myself (though I got the highest grade on the assignment).
This was back when we could assume 8-bit encodings(iso 8859-1 was the one we used). Simpler times!
If you’re skeptical, I really do encourage you to watch, he’s not sloppy.
https://youtu.be/AxnotgLql0k