Node.js perf_hooks: A High-Precision Stopwatch for Your App
The `perf_hooks` module is a high-precision stopwatch for your Node.js code, offering nanosecond accuracy. Use it to benchmark async operations or HTTP request durations.
The `perf_hooks` module is a high-precision stopwatch for your Node.js app, providing nanosecond-level timing to diagnose bottlenecks. It mirrors the browser's Performance API for consistent measurement. Use it to time async operations, dependency loads, or network events like DNS lookups. The main footgun is using `Date.now()` for benchmarking; it lacks precision and is affected by system clock adjustments, making `perf_hooks` the reliable choice for performance analysis.
Read the original → nodejs.org
- #nodejs
- #performance
- #profiling
- #backend
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.