Optimizing Performance

Tell a performance story the way a careful engineer works: measure first, find the real bottleneck, fix it, prove the gain and keep it from coming back.

Overview

Performance questions ask about a time you made something faster or cheaper. The interviewer is checking your method more than your result. Did you measure before you changed anything? Did you find where the time actually went, or guess? Did you pick a target that mattered to users or cost? And did you ship the change safely and keep it from slowly getting worse again?

The weakest answer is 'I refactored the code and it got faster'. Without a baseline and a measurement after, nobody can tell a real improvement from luck, and the interviewer will assume you guessed.

The performance method

A strong story follows one method in two phases, and every step produces evidence. Skip one and the story turns into a guess. Steps 1 to 3 find the cost; steps 4 to 6 fix it and keep it fixed.

  • Target: decide which metric to improve, and how fast it must be.
  • Measure: take a baseline at p50 and p99. (p50 is the median request; p99 is the request slower than 99% of the others.)
  • Profile: find where the time actually goes.
  • Fix: attack the biggest cost first.
  • Verify: run the same test again and compare the new numbers.
  • Guard: add an alert or a test in CI so the gain lasts.

Interview questions

  • Tell me about a time you improved a system's performance
  • How do you find a performance bottleneck?
  • How do you set a performance target?
  • What are common performance optimization mistakes?

Sign up free to read the full topic

More Behavioral topics

Start free on Cariara · Coding problems · System design studio