3 ms·
I really love the trick for efficiently reading 4 chars and checking them out of a string. I like it so much I've been working towards making it happen automat
by kingkilr 15y ago
I really love the trick for efficiently reading 4 chars and checking them out of a string. I like it so much I've been working towards making it happen automatically on PyPy so if you write something like:
if buf[i:i+4] == "POST":
the JIT automatically turns that into a MOVL + CMP + JMP. The magic of high level languages :)