Software Engineer
Tell me about a time you made slow code noticeably faster. How did you find the bottleneck and what did you change?
What the interviewer is looking for
- This question tests coding fundamentals & data structures. Picks data structures for stated reasons, talks about time and memory costs plainly, and describes measuring before optimising.
- What to bring out: Measuring with a profiler or timings first, identifying the real hotspot, a concrete change such as better algorithm, caching or fewer queries, and verifying the improvement.
- Expect a follow-up like: Was there a trade-off, such as more memory or more complex code, and was it worth it?
Another way it may be asked: Think of a page, job or function that was too slow. How did you figure out where the time went, and what fixed it?
A structure to follow: STAR, with the weight on Action and Result
- Step 1
Situation
One or two sentences: where, when and what was at stake. Pick a real example you were close to.
- Step 2
Task
What you personally were responsible for. Say "I", not only "we", so the coding fundamentals & data structures you showed is visible.
- Step 3
Action
The two or three things you did and why you chose them over the alternatives. This should be about half your answer.
- Step 4
Result
What changed, in your own measure of it, and what you would do differently. Only use numbers you can stand behind.
This is guidance on shape, not a script. Use your own real experience and facts; never invent details to fill a gap. See the STAR guide and answer frameworks.
Common slips
- Describing what the team did without saying what you did.
- Choosing an example with no clear outcome, or one you cannot answer detailed questions about.
- Ending on the action and skipping the result and what you learned.
How to practise it
Write two bullet points for each STAR letter, then say the answer aloud in about two minutes.
Related questions
- When would you pick a hash map over a list to store data, and what does that choice cost you?
- Imagine your code works on your laptop but fails in the test environment. Walk me through how you would start figuring out why.
- How do you usually use Git day to day, from starting a piece of work to getting it merged?
- How do you decide what to test in a new feature, and how do you balance unit tests against integration tests?
- Tell me about the trickiest bug you have tracked down. How did you find the root cause?