My first move is to look at numbers before touching code. I check response time percentiles in my APM tool, not averages, because p95 and p99 are where the real pain lives. Then I attach Chrome DevTools profiler (or 0x) to the running process: it samples the event loop, garbage collection, and I/O in one shot and points me at the biggest contributor. If the flame graph shows a hot synchronous path, I check whether a library is blocking the main thread. If it shows I/O wait, I look at query plans and connection pool saturation. For CPU-bound slowness I run --inspect in staging and record a CPU profile in Chrome DevTools. Nine times out of ten the culprit is an unindexed query, a missing pool limit, or a synchronous JSON parse on a large payload.
Insider read
Really testing: Interviewers want to see a structured diagnostic loop, not a list of tools. The scoring question is: does the candidate measure first, then hypothesize, then verify?
The tell: Juniors say they would add console.time timers or guess at the slow line. Seniors describe pulling percentile metrics, attaching clinic.js, reading the flame graph to isolate the bottleneck, and fixing the root cause with a reproducible test.
Follow-up: "How would you tell whether the slowness is in your application code versus the database versus a downstream service?"
Say this"I never guess at a performance problem. I measure first with clinic.js or a CPU profile, identify the single biggest contributor, fix it, and measure again. Premature optimization is bad, but so is random optimization."