Keep the successful render path synchronous and allocation-light - #1556
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lookupEnvtri-state callback) so cached renders stop suspending through a discarded promise/microtaskgetComponent, nested renderer bound to the registry conf, andfromPromiseadapters forrenderComponent/renderComponentscomponent-retrievedtelemetry only at completion when a listener exists (one scalarhrtime.bigint()start timestamp; no payload allocation, end-clock read, orfirewhen unobserved), preserving mid-flight listener add/remove semanticsasyncfrom the callback renderer and make normalreturnComponentcompletion synchronous; move local source-map/stack enrichment into a cold async helper that still finishes enrichment before the public callback and falls back to the original stack on failureget-component-retrieving-info.ts; addframe?: stringto the response details type to match runtime behaviorPreserved invariants: exact-once completion, timeout cleanup before event/callback, Domain execution, ENV_RESOLVING_ERROR / DATA_RESOLVING_ERROR behavior, single-flight storage reads, and renderer-return → provider → event → callback ordering. The only timing change is removal of an internal warm-env microtask.
Benchmarks (same machine, clean-tree baseline vs this branch)
17ms→17ms (N=50) and ~30ms (N=200)--max-rps-regression-percent=5 --max-p95-regression-percent=5 --expect-success-rate=1Test plan
registry-routes-helpers-get-component-timing.js: renderer-return-before-callback trace with microtask sentinel, repo→env→provider gating, sync throw / async success-failure / double-callback exact-once, timeout cleanup ordering, retrieval payload key parity (success + error), local enrichment ordering and fallback, warm env hit without a second repository env lookup, real-events-handler mid-flight listener add/removehasListenerscontractnpm --workspace packages/oc run buildnpm --workspace packages/oc run test-silent(1052 passing)npm --workspace packages/oc run bench:burstCloses plan 006 in
plans/README.md.