Repository navigation
Conversation
The TypeScript side of rust/bench/examples/corpus: the same 16 short programs against a host that answers at once, as median microseconds of compile, a fresh run's setup, and the program. On dev: setup is 78 of the 80 µs return 1 takes, 63% of the corpus.
A run makes several hundred built-in functions before its program starts, each through two calls of define, which checks for an array, an intrinsic and a guard: none of which a function just made can be. script/corpus.ts: setup 78 to about 72 µs.
Each run split every prelude function's name and walked its path with a slice and a reduce. script/corpus.ts: setup about 72 to about 64 µs.
…nd plain arguments Every String.prototype method built two arrays and a closure to ask whether anything needed converting, before doing its work. A string receiver whose hinted arguments are not objects, which is nearly every call, goes straight to it. script/corpus.ts: the grep program about 90 to 64 µs, line counting about 187 to 167 µs.
This branch has not been deployed
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.
Three small speed-ups to the TypeScript implementation and a benchmark to measure them with. Source change: 3 files, +23/−7.
script/corpus.ts: runs the 16 short programs ofrust/bench/corpus(a few tool calls and the glue between them) against a host that answers at once, and reports median microseconds by phase: compile, a fresh run's setup, the program.bun run script/corpus.ts rust/bench/corpus.nameandlengthwithoutdefine's checks. A run makes several hundred built-in functions before its program starts, each through two calls ofdefine. Setup about 78 → 72 µs.Corpus total about 1,918 → 1,750 µs (9%). These are wall-clock medians taken on a busy machine, so approximate.
Not changed: setup is still about 60% of the corpus, nearly all of it making the built-ins for each run. Not making them (lazy groups, or reusing a runtime) is a structural change and is left alone here.
bun testandbun run test:roundtrippass (1,648 tests).