-
-
Notifications
You must be signed in to change notification settings - Fork 1
benchmark: replace simulation with walltime macro benches + e2e correctness #91
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
natemoo-re
wants to merge
6
commits into
main
Choose a base branch
from
ci-bench
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
6 commits
Select commit
Hold shift + click to select a range
159d617
test: add input event-loop integration test
natemoo-re 79a5431
bench: add macro throughput WallTime bench
natemoo-re 1f32014
bench: remove input micro-suite (codegen-cliff artifacts)
natemoo-re f5fee1c
ci(bench): pin build runner and drop wasm cache
natemoo-re 2848084
fix(ci): return a promise from throughput bench for CodSpeed walltime
natemoo-re 154a293
bench: move render/ops to WallTime macro benches, drop the simulation…
natemoo-re 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
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| import "./input.bench.ts"; | ||
| import "./throughput.bench.ts"; | ||
| import "./render.bench.ts"; | ||
| import "./ops.bench.ts"; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { Bench } from "tinybench"; | ||
| import { withCodSpeed } from "@codspeed/tinybench-plugin"; | ||
| import { createInput } from "../input.ts"; | ||
|
|
||
| function str(s: string): Uint8Array { | ||
| return new TextEncoder().encode(s); | ||
| } | ||
|
|
||
| function concat(parts: Uint8Array[]): Uint8Array { | ||
| let len = parts.reduce((n, p) => n + p.length, 0); | ||
| let out = new Uint8Array(len); | ||
| let off = 0; | ||
| for (let p of parts) { | ||
| out.set(p, off); | ||
| off += p.length; | ||
| } | ||
| return out; | ||
| } | ||
|
|
||
| let unit = concat([ | ||
| str("the quick brown fox "), | ||
| new Uint8Array([0x1b, 0x5b, 0x41]), // ArrowUp | ||
| str("\x1b[<0;40;12M"), // SGR mouse press | ||
| new Uint8Array([0xe4, 0xb8, 0xad]), // 中 | ||
| str("\x1b[97;3u"), // Kitty a+Alt | ||
| new Uint8Array([0xf0, 0x9f, 0x8e, 0x89]), // 🎉 | ||
| ]); | ||
| let corpus = concat(new Array(1000).fill(unit)); | ||
|
|
||
| let READ = 64; | ||
|
|
||
| let input = await createInput({ escLatency: 25 }); | ||
|
|
||
| let bench = withCodSpeed(new Bench({ name: "throughput" })); | ||
|
|
||
| bench.add("input throughput (mixed corpus, chunked read loop)", () => { | ||
| let dispatched = 0; | ||
| for (let off = 0; off < corpus.length; off += READ) { | ||
| let { events } = input.scan(corpus.subarray(off, off + READ)); | ||
| dispatched += events.length; | ||
| } | ||
| if (dispatched === 0) throw new Error("expected events"); | ||
| return Promise.resolve(); | ||
| }); | ||
|
|
||
| await bench.run(); | ||
| console.table(bench.table()); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a comment or perhaps a README.md in this folder explaining why this is required? I am assuming it is to force a last microtask or something? I don't see anything within the
tinybenchAPI that would point to the value of doing this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll add that! It's a limitation of the @codspeed/plugin-tinybench package, which only expects the task to be async. With synchronous tasks, it throws an error like "cannot destructure 'latency' from undefined"