Repository navigation
process: let inline caches work on process.env and process.argv #44356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jarred-Sumner
wants to merge
4
commits into
main
Choose a base branch
from
claude/process-env-argv-inline-caches
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e1a44fc
process: let inline caches work on process.env, process.argv and proc…
Jarred-Sumner 1d95a0b
process.test.js: make the new process.env tests concurrent, pin the d…
robobun ba9ff1c
process.env: use the PutById slot for every store that can add a prop…
robobun e6621c3
ci: retrigger
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { bench, run } from "../runner.mjs"; | ||
|
|
||
| // What a program does before the code that is measured here runs: | ||
| // a copy for a child process, which reads every variable, | ||
| globalThis.childEnv = { ...process.env }; | ||
| // a feature flag that is checked often, | ||
| for (let n = 0; n < 20_000; n++) globalThis.flag = process.env.NOT_SET_FLAG; | ||
| // and dotenv-style writes. | ||
| for (const key of ["BENCH_A", "BENCH_B", "BENCH_C"]) process.env[key] = "1"; | ||
| delete process.env.BENCH_C; | ||
|
|
||
| const keys = ["HOME", "PATH", "BENCH_A", "NOT_SET_1", "NOT_SET_2", "USER", "NOT_SET_3", "BENCH_B"]; | ||
| let i = 0; | ||
|
|
||
| bench("process.env.HOME", () => process.env.HOME); | ||
| bench("process.env.NOT_SET", () => process.env.NOT_SET); | ||
| bench("process.env[key]", () => process.env[keys[i++ & 7]]); | ||
| bench("process.env.BENCH_A = 'value'", () => { | ||
| process.env.BENCH_A = "value"; | ||
| }); | ||
| bench("{ ...process.env }", () => ({ ...process.env })); | ||
| bench("Object.keys(process.env)", () => Object.keys(process.env)); | ||
| bench("process.argv", () => process.argv); | ||
| bench("process.argv[1]", () => process.argv[1]); | ||
| bench("process.argv.length", () => process.argv.length); | ||
| bench("process.execArgv", () => process.execArgv); | ||
|
|
||
| await run(); |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.