startup: add tracing improvements and fix help fast path#67
Open
sonukapoor wants to merge 2 commits intowasmerio:mainfrom
Open
startup: add tracing improvements and fix help fast path#67sonukapoor wants to merge 2 commits intowasmerio:mainfrom
sonukapoor wants to merge 2 commits intowasmerio:mainfrom
Conversation
b2b9f1f to
75abb89
Compare
Contributor
Author
|
@syrusakbary Please take a look |
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
This PR improves startup observability, documents the cold-start investigation, keeps a small CLI startup optimization, and adds a native
--helpfast path that fixes broken non-interactive help output and makes--helpabout 7.7x faster.It adds finer-grained host-side startup tracing before JS bootstrap, including:
It also includes a low-risk CLI startup optimization that avoids unnecessary
cwdresolution when neither--env-file*nor--experimental-config-file*is present.Why
The existing startup trace was useful for JS/bootstrap attribution, but it was still too coarse on the host side.
This PR makes it easier to answer where startup time is going before first useful JS executes, especially around:
It also adds a startup investigation document so future optimization work can build on measured findings rather than repeated guesswork.
What changed
Startup tracing
Added or expanded host-side trace phases such as:
cli.env.openssl.configure.begincli.env.openssl.configure.endcli.env.openssl.csprng-check.begincli.env.openssl.csprng-check.endcli.env.create-napi-envcli.env.attach-runtime.environmentcli.env.attach-runtime.process-exit-handlercli.env.attach-runtime.cleanup-stagesCLI startup optimization
Improved effective CLI-state handling so simple startup paths do not resolve
cwdunnecessarily when env/config-file features are not in use.Documentation
Added
docs/startup-investigation.md, covering:Findings
Current findings from the investigation:
edge --versionalready avoids OpenSSL and N-API environment creationedge --helpdoes not appear to semantically require OpenSSL, but still goes through runtime/bootstrap in the current implementationedge -e ""still genuinely requires runtime/bootstrap and N-API environment creationMeasurement
Using repeated
hyperfineruns against a saved baseline binary:edge -e ""41.6 ms ± 1.340.9 ms ± 1.01.7%improvementedge benchmarks/workloads/empty-startup.js40.4 ms ± 1.240.2 ms ± 0.8The host-side follow-up tracing improved attribution further, but did not produce an additional measurable speedup on its own.
What this PR does not do
--helpVerification