Skip to main content
btheo.com btheo.com > press start to play
NEW POST: NODE.JS SECURITY 2025 OPEN FOR FREELANCE 10+ YEARS EXP REACT × NODE × AWS NEW POST: NODE.JS SECURITY 2025 OPEN FOR FREELANCE 10+ YEARS EXP REACT × NODE × AWS
TIL · 29 APR 2026 · NOTE #028 ESC
TIL NOTE #028

console.time Is the Fastest Profiler You Already Have

Something is slow. Your instinct is to fire up a profiler.

Start here instead:

console.time("database query");
const result = await db.query(sql);
console.timeEnd("database query");
// Outputs: database query: 234.5ms

Takes 3 seconds to add. No setup. Instant feedback.

If the query is 234ms and the request is 2000ms, the database isn’t the problem. Keep digging.

Once you find the real bottleneck, then use clinic.js or Chrome DevTools to see the flame graph and optimize the exact lines.

80% of the time, console.time is enough. The 20% that needs deeper profiling is obvious once you measure.

Profile iteratively. Measure first, optimize second.