3 ms·
Years ago I worked on Python optimizations for the string type. I tried speeding up .upper() and .lower() by replacing things like: if (isupper(c))
by dalke 13y ago
Years ago I worked on Python optimizations for the string type. I tried speeding up .upper() and .lower() by replacing things like:
if (isupper(c))
s[i] = _tolower(c);
with:
s[i] = _tolower(c);
My mental model, which was still influenced by the microcomputer era, did not match the hardware. Benchmarks quickly identified that my "faster" implementation was actually noticeable slower. That's when I first started to understand cache lines.