Profiling intro (Node/DevTools) — tiny timing habits
Profile in tiny steps: measure with console.time/timeEnd and simple timers, find hot code, change one thing, and re-measure.
Why profiling?
Goal: Measure → change → measure again.
- Use console.time/timeEnd for quick timing
- Use a tiny now() helper for manual timings
- Focus on hot code only
- Make one change at a time

console.time demo
console.time prints how long the labeled block took. Great first step.
// Measure a small loop with console.time/timeEnd
console.time("sum");
let s = 0;
for (let i = 0; i < 100000; i = i + 1) {
s = s + i;
}
console.timeEnd("sum");
console.log("sum value:", s);

All lessons in this course
- Big-O basics, hot vs cold paths (beginner wins)
- Avoiding leaks — closures, timers, references
- Profiling intro (Node/DevTools) — tiny timing habits