Hacker News new | ask | show | jobs
by johnfn 3378 days ago
What a fun example.

I once had some code that I managed to speed up around 90%. It was returning a massive data structure that another function would then operate on. I sped it up by removing the data structure entirely, and instead adding a callback that would be called for each element of the data structure.

It's not always possible to do, and half the time it doesn't even help, but every now and then it's a good way to optimize.