logoalt Hacker News

db48x • today at 12:47 PM • 1 reply • view on HN

Yea, I love being able to go from the new guy at a new job straight to the performance wizard in the first week, or even on the first day. It’s so fun to stare into the depths of a flamechart and then point out where the problems are.

At one job they had built this whole nifty SQL library and used it everywhere. In the first profile I took I saw that repeatedly preparing a query took more time than running it and using the data. Each call to prepare took the same amount of time as the others, so it was obvious at a glance that they weren’t caching and reusing the results. The documentation said that they did, and their tests all worked, so they had used it for years even though it was fundamentally broken. That was a fun week.


Replies

skydhash • today at 12:55 PM

Any loop is the prime suspect for optimization. I’ve seen a lot of naive implementation of something instead of using standard algorithms.