Skip to content

feat(perf_hooks): observe({ buffered: true }) delivers pre-existing entries (#1390)#1441

Merged
proggeramlug merged 1 commit into
mainfrom
fix/perf-observe-buffered-1390
May 22, 2026
Merged

feat(perf_hooks): observe({ buffered: true }) delivers pre-existing entries (#1390)#1441
proggeramlug merged 1 commit into
mainfrom
fix/perf-observe-buffered-1390

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

PerformanceObserver.observe({ type, buffered: true }) should deliver entries created before observe() was called (node:perf_hooks gap #1390, umbrella #793). Perry never delivered them — the callback didn't fire.

js_perf_observer_observe now parses the buffered flag; when set, it copies the timeline entries matching the observed type(s) into the observer's pending buffer and arms the async flush, so the callback fires on a later turn with the pre-existing entries. Non-buffered observe() is unchanged.

Test

Flips test-parity/node-suite/perf_hooks/observer/buffered to PASS (buffered count: 2); all other observer tests (observe-marks/measures, multiple-observers, take-records, …) still pass.

Closes #1390.

…ntries (#1390)

PerformanceObserver.observe({ type, buffered: true }) now queues the
timeline entries that already match the observed type(s) and arms the
async flush, so the callback fires on a later turn with entries created
before observe() was called — matching Node. Non-buffered observe is
unchanged. Flips node-suite/perf_hooks/observer/buffered to PASS.
@proggeramlug proggeramlug merged commit 3f907e2 into main May 22, 2026
9 checks passed
@proggeramlug proggeramlug deleted the fix/perf-observe-buffered-1390 branch May 22, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:perf_hooks — observe({ buffered: true }) should deliver pre-existing entries

1 participant