Excellent post showing how to correctly improve code w.r.t. performance using the scientific method: hypothesis, measuring the baseline, change, measuring effect with real tools, real code. Thanks for sharing!
I also found it an interesting post in that it kind of inadvertently proves that for most situations you shouldn't optimise to this extent. Meaning, yes, the OP got impressive performance improvements but the code is also completely unreadable and utilises unsafe code sections which could expose you to security problems/memory leaks/memory corruption. Not to mention they've recreated and will need to maintain an in-h…
What it latency for a single request can't be improved with more cores?
What if your product is used by consumers who may have old hardware? or phones, or watches, or laptops and they want their battery to last?
What if you consistently practiced at making high performance code, maybe then it wouldn't seem "unreadable" to you any more?
What if Linq-like higher order functions weren't slow? https://github.com/jackmott/LinqFaster
What if slow software was common today because of modern attitudes, and I wasn't seeing any increase in stability or features to show for it?