Repository navigation
feat(benchmarks): the tick cost as a committed, repeatable measurement - #10
Closed
Immanuel-Fowler wants to merge 1 commit into
Closed
Immanuel-Fowler wants to merge 1 commit into
Immanuel-Fowler wants to merge 1 commit into
Conversation
The 8 ns tick_sync and ~1.5 ns host-call figures lived in the 0.8.1 release notes and an ignored test. benchmarks/tick_cost/run.py builds six small library programs, drives each through tick_sync on a current-thread runtime in release mode, and reports the median of 21 rounds of 200,000 ticks beside the Host trait method called through its vtable alone, with the same environment header as the boundary ladder. The fastest round is reported too and is the figure to derive from: on Apple Silicon the scheduler moves the thread between core types during a run, so medians overlap within a few nanoseconds. The shared let case would not compile, which turned up two 0.13.0 gaps in every mode. A block whose tail statement touches shared state — an on_tick body, a while body, an if branch — was compiled without the lock and reached rustc as an unknown __shared; a block tail now takes the lock as a statement does, and one that also waits is refused with the existing message. And a let whose initialiser reads shared state was wrapped whole in the lock's block, so its binding was gone on the next line; the lock now wraps only the initialiser. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 21, 2026
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.
Stacked on #9 (
feat/boundary-ladder-benchmark); merge that first.What
benchmarks/tick_cost/run.pyturns the 8 nstick_syncand ~1.5 ns host-call figures, which lived only in the 0.8.1 release notes and an ignored test, into a committed, repeatable measurement with the same environment header as the boundary ladder.Six small library programs are built with
build --liband driven by one Rust host throughtick_syncon a current-thread runtime in release mode: an empty tick, one host call, five host calls, an instanceletincrement, ashared letincrement, and one host-fired event per tick. Each case is warmed up with five rounds, then timed for 21 rounds of 200,000 ticks; the median round is reported with the fastest and the p90 round, next to theHosttrait method called through its vtable alone, which is the floor for a host call. Output:tick_cost.csv,tick_cost.json,tick_cost.mdunderbenchmarks/results/. The README's table is pasted from the generated Markdown.Found and fixed on the way
The
shared letcase would not compile: a block whose tail statement touches shared state (on_tick(dt: float) { hits = hits + 1 }, but equallywhile c { hits = hits + 1 }andif c { hits = hits + 1 }) was compiled without the lock guard and reached rustc as an unknown__shared. A v0.13.0 gap in every mode. Fixed incompile_block_inner: a block tail that touches shared state takes the lock exactly as a statement does, and one that also waits is refused with the existing message. Regression tests:runtime_shared_state_in_a_block_tail_takes_the_lockandlibrary_shared_state_in_hooks.Changelog entries under
[Unreleased]. No version bump.🤖 Generated with Claude Code