node:perf_hooks
#Import
import perf_hooks from "nstdlib/node/perf_hooks";Note
The API is available, but not everything works. performance.now(), mark/measure and the JavaScript-side observers work on the host performance. GC, event-loop and nodeTiming measurements need C++ instrumentation and throw.
#Support
- nstd: Not measured in this environment.
- Browser: Loads with a minimal
processobject. 15 of Node's 15 exports are available. 1 of 1 behavior checks match Node.js.
#Exports (15)
Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:
- ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
- ⚠️ A value one way,
undefinedthe other. - ❔
undefinedboth ways. - ❌ Not exported at all.
- – Not measured.
| Export | Node.js | Browser |
|---|---|---|
Performance | ✅ | ✅ |
PerformanceEntry | ✅ | ✅ |
PerformanceMark | ✅ | ✅ |
PerformanceMeasure | ✅ | ✅ |
PerformanceObserver | ✅ | ✅ |
PerformanceObserverEntryList | ✅ | ✅ |
PerformanceResourceTiming | ✅ | ✅ |
constants | ✅ | ✅ |
createHistogram | ✅ | ✅ |
createSlidingWindowHistogram | ✅ | ✅ |
eventLoopUtilization | ✅ | ✅ |
importHistogram | ✅ | ✅ |
monitorEventLoopDelay | ✅ | ✅ |
performance | ✅ | ✅ |
timerify | ✅ | ✅ |
#Diagnostics
nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:
coverage: 15/15 of the host's export names answer inside host node. API only.performance.now(),mark/measureand the JavaScript-side observers work on the hostperformance. GC, event-loop andnodeTimingmeasurements need C++ instrumentation and throw.smoke: Imports in a clean child process.