Profile Before You Optimise: A Five-Minute Habit
Most “slow” code is not slow where you think it is. Measure first, fix second — here is the five-minute loop, from flame graphs to the number you paste into a pull request.
Language features, algorithms, debugging techniques and everyday coding craft.
4 articles
Most “slow” code is not slow where you think it is. Measure first, fix second — here is the five-minute loop, from flame graphs to the number you paste into a pull request.
Two requests touch the same row and one update silently disappears. How version checks, SELECT FOR UPDATE and retry loops behave in production, and how to pick between them.
Nobody complains about a 40 ms query. Everybody complains about four hundred of them per page. Read EXPLAIN column by column, and find the N+1 before your users do.
A stack trace is a map, not a verdict. Read it from both ends, find the frame that is yours, and turn the message into a ten-line reproduction.