Fascinating discussion of whether it's safe to read past the end of a buffer if you stay on the same page: https://stackoverflow.com/q/37800739
(A technique used in some high performance assembly code!)
Related Posts
It's really satisfying to use a profiler for the first time on a project. I always find a big performance win with only a small code change.
It's never the code that I expected to be slow, however!
It's so strange that we talk about languages being slow, and have done for years. Computer performance has increased so much in this time.
https://hbfs.wordpress.com/2009/11/10/is-python-slow/ (shared on HN in 2009) discusses Python being slow. My underpowered Thinkpad has 20x the single-threaded performance! https://www.cpubenchmark.net/compare/73vs3766/AMD-Athlon-64-4000+-vs-AMD-Ryzen-5-PRO-4650U
Maybe *relative* performance of languages matters more?
TIL Tcl has a notion of 'safe interpreters', a mode where you can run untrusted code in a sandbox: https://www.tcl.tk/man/tcl8.4/TclCmd/safe.htm
Not many programming languages have this, but it's way safer to include in the implementation than try to build as a userland library.