The biggest gains here come from doing less work. Lazy merge reads only enough to produce a prefix. An indexed priority queue finds each entry by value after building its index. The table shows exactly what was timed or checked.
Workloads and baselines
Section titled “Workloads and baselines”| Claim | Baseline | Class | Address |
|---|---|---|---|
| Roaring bitset intersection count, 528× faster | a manual Set loop over two 100,000-ID ranges |
algorithmic comparison | Bitset timings |
| First 32 sorted IDs from eight lists, 408× faster | materialize and sort all 32,768 IDs | algorithmic comparison | Sorted-merge timings |
| Build a queue and update all 1,000 keys, 272× faster | heap-js linear remove plus push |
algorithmic comparison | Priority-queue timings |
| Build 100,000 singleton sets, 164× faster | a Map of Sets |
algorithmic comparison | Disjoint-set timings |
p-values agree with SciPy 1.15.3 to 1e-9 |
SciPy’s published reference values, pinned as fixtures | statistical parity | __tests__/fixtures/PROVENANCE.md |
| 25 TLA+ models replay against the implementations | each package’s own implementation | model conformance | verification/ |
43 subpaths smoke-tested in Bun.WebView |
33 modules plus 10 /wire entrypoints |
browser compatibility | CI workflow |
| 39.1% lower latency, toy target, zero-cost draft | target-only decoding; Qwen 0.5B draft: 37.4% slower | research result | problems/speculative-decoding/docs/RESULTS.md |
These ratios capture differences in the work each implementation does. The benchmark gallery names every baseline and includes panels where native JavaScript wins.
What the measurements cover
Section titled “What the measurements cover”- One machine, one runtime, one fixture. The figures are historical. Each problem README records its machine, seed, and command; re-run the benchmark on your target hardware before making a runtime decision from one.
- Microbenchmarks measure the whole workload invocation, including construction where the panel says build, fill, or heapify. They do not measure your call site.
- Accuracy figures are fixture-bound. The MinHash banding result — 77 of 79,800 pairs scored, all 62 matches above the 0.6 Jaccard threshold recovered — is one pinned 400-document corpus, not a guarantee for another corpus.
- Model replay checks bounded correctness. The TLA+ models and implementation traces check invariants such as order and multiplicity on the states they cover.
The interface-overhead study
Section titled “The interface-overhead study”bun run bench:overhead runs each caller workload twice: through Knotkit’s public API, and as a hand-written loop of
the same algorithm. The ratio of the two medians is the interface overhead, the price of the abstraction rather than of
the algorithm. Every panel is therefore audited yes or no for “same algorithm as the baseline”, and a no cell
moves to a separate Algorithm choice section instead of being counted as overhead. The losses stay in. Its capture is
local data: re-run the command to read the current numbers.
Run the benchmarks yourself
Section titled “Run the benchmarks yourself”git clone https://github.com/jkomyno/knotkit.git && cd knotkitbun installbun --bun run benchThe recorded timings are in the benchmark explorer.
Where the numbers live
Section titled “Where the numbers live”| Artifact | Content |
|---|---|
evidence/benchmarks/results.json |
every row’s five within-run p50s, plus runtime and machine |
evidence/benchmarks/README.md |
one section per panel, stating its baseline |
packages/*/__tests__/bench |
the suites, deterministic and re-runnable |
problems/*/README.md |
per-workload fixture, seed, command, and result |
verification/models |
the TLA+ models checked against the code |