Summary
Node performance.eventLoopUtilization(utilization1, utilization2) computes the delta between two prior readings. Perry's runtime helper and dispatch path only accept/pass the first argument, so the two-argument form is treated like the one-argument current - utilization1 form.
Node 25.9.0 behavior
const { performance } = require("node:perf_hooks");
const a = performance.eventLoopUtilization();
setTimeout(() => {
const b = performance.eventLoopUtilization();
const twoArg = performance.eventLoopUtilization(b, a);
const oneArg = performance.eventLoopUtilization(b);
console.log(twoArg); // roughly b - a
console.log(oneArg); // roughly current - b, a different/smaller interval
}, 50);
Local Node v25.9.0 after the delay produced a two-argument result with about 51ms idle / 0.46ms active, while the one-argument eventLoopUtilization(b) result represented only the tiny interval after b was captured.
Perry source evidence
crates/perry-runtime/src/perf_hooks.rs::js_perf_event_loop_utilization(prev: f64) has a single prev parameter and only computes cumulative values or current - prev.
- Dynamic dispatch in
crates/perry-runtime/src/object/native_module_dispatch.rs calls js_perf_event_loop_utilization(arg(0)) and drops arg(1).
- Static lowering in
crates/perry-codegen/src/lower_call/native/perf_hooks.rs also lowers only argument 0 for eventLoopUtilization.
Expected
performance.eventLoopUtilization(utilization1, utilization2) should subtract utilization2 from utilization1, matching Node. The existing zero-arg cumulative form and one-arg current - previous form should keep working.
Duplicate checks
eventLoopUtilization two argument
perf_hooks eventLoopUtilization util1 util2
I did not find an existing issue for the two-argument eventLoopUtilization() overload.
Summary
Node
performance.eventLoopUtilization(utilization1, utilization2)computes the delta between two prior readings. Perry's runtime helper and dispatch path only accept/pass the first argument, so the two-argument form is treated like the one-argumentcurrent - utilization1form.Node 25.9.0 behavior
Local Node v25.9.0 after the delay produced a two-argument result with about 51ms idle / 0.46ms active, while the one-argument
eventLoopUtilization(b)result represented only the tiny interval afterbwas captured.Perry source evidence
crates/perry-runtime/src/perf_hooks.rs::js_perf_event_loop_utilization(prev: f64)has a singleprevparameter and only computes cumulative values orcurrent - prev.crates/perry-runtime/src/object/native_module_dispatch.rscallsjs_perf_event_loop_utilization(arg(0))and dropsarg(1).crates/perry-codegen/src/lower_call/native/perf_hooks.rsalso lowers only argument 0 foreventLoopUtilization.Expected
performance.eventLoopUtilization(utilization1, utilization2)should subtractutilization2fromutilization1, matching Node. The existing zero-arg cumulative form and one-argcurrent - previousform should keep working.Duplicate checks
eventLoopUtilization two argumentperf_hooks eventLoopUtilization util1 util2I did not find an existing issue for the two-argument
eventLoopUtilization()overload.