Hanselminutes with Scott Hanselman cover image

All the Performance with RavenDB's Oren Eini

Hanselminutes with Scott Hanselman

CHAPTER

How to Optimize String Work to a Tight Loop

When we think of low level string work, which is not low level, it's string.index of. So when that gets optimized all the way down into the silicon, we enroll and then you're in the middle of multiple for loops or something like that. But now you optimize that to a tight loop that is maybe 10, 15 instructions using a dedicated assembly command just for that particular scenario. And suddenly the code is much more efficient, but then you have another impact. It's much smaller, so it has better inline kit, so it's able to inline the method. Now, what's the cost of a method called? Well, you have to save the registers, do a

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner