Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSperf_hooks timingSingle-choice MCQ

You wrap a synchronous function with performance.timerify and observe 'function' entries. What does each emitted PerformanceEntry's duration represent?

const { performance, PerformanceObserver } = require('node:perf_hooks'); function hash(n) { let s = 0; for (let i = 0; i < n; i++) s += i; return s; } const timed = performance.timerify(hash); new PerformanceObserver((l) => console.log(l.getEntries()[0].duration)) .observe({ entryTypes: ['function'] }); timed(1e6);