dash_read_bounds: time the short and long runs in turn, the least of seven each #400

Merged
dcharlot merged 2 commits from fix/dash-bounds-interleave into main 2026-10-21 14:38:59 -04:00
Owner

tests/dash_read_bounds.rs failed on the linux-arm64 cargo-class corpora job of #396 and of #398. Neither PR touches DASH:

40000 attributes took 181.645665ms, 10000 took 10.836208ms   (#396)
40000 attributes took 120.173833ms, 10000 took 11.007458ms   (#398)

The reader is linear. Duplicate names go through a HashSet, and everything else reads slices. Two effects push a linear reader past the bound of 8 times on a busy virtual machine:

  • CPU time includes host time. A thread's CPU clock also counts the time the host held the virtual CPU.
  • Cache. The larger element's sets leave a cache the host shares, so each attribute costs up to about three times more.

That puts linear near 12 times, against 16 for a reader that scans the names read so far. The two are too close to bound.

Two changes:

  1. Runs in turn. Each comparison times its two cases alternately, seven runs each, and keeps the least of each. A busy spell then slows both alike.
  2. Sizes 32 apart. The attribute check now compares 1000 attributes with 32000. Linear is about 32 times, or about 100 with the cache effect. A quadratic reader is about 1000 times. The bound is 256 times plus 20 ms.

The run-by-run comparison check is unchanged apart from (1).

check (build host) result
cargo test --no-default-features --features http --test dash_read_bounds, 10 runs 10/10 pass
the same with the reader made quadratic (each attribute scans the names read so far) fails on the timing assertion every run: 32000 attributes took 3.61s, 1000 took 4.18ms (bound ≈ 1.09 s)

🤖 Generated with Claude Code

`tests/dash_read_bounds.rs` failed on the linux-arm64 cargo-class corpora job of #396 and of #398. Neither PR touches DASH: 40000 attributes took 181.645665ms, 10000 took 10.836208ms (#396) 40000 attributes took 120.173833ms, 10000 took 11.007458ms (#398) The reader is linear. Duplicate names go through a `HashSet`, and everything else reads slices. Two effects push a linear reader past the bound of 8 times on a busy virtual machine: - **CPU time includes host time.** A thread's CPU clock also counts the time the host held the virtual CPU. - **Cache.** The larger element's sets leave a cache the host shares, so each attribute costs up to about three times more. That puts linear near 12 times, against 16 for a reader that scans the names read so far. The two are too close to bound. Two changes: 1. **Runs in turn.** Each comparison times its two cases alternately, seven runs each, and keeps the least of each. A busy spell then slows both alike. 2. **Sizes 32 apart.** The attribute check now compares 1000 attributes with 32000. Linear is about 32 times, or about 100 with the cache effect. A quadratic reader is about 1000 times. The bound is 256 times plus 20 ms. The run-by-run comparison check is unchanged apart from (1). | check (build host) | result | |---|---| | `cargo test --no-default-features --features http --test dash_read_bounds`, 10 runs | 10/10 pass | | the same with the reader made quadratic (each attribute scans the names read so far) | fails on the timing assertion every run: `32000 attributes took 3.61s, 1000 took 4.18ms` (bound ≈ 1.09 s) | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dash_read_bounds: time the short and long runs in turn, the least of seven each
Some checks failed
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 15s
wai-web wasm32 / does this change touch it (pull_request) Successful in 13s
joule-moq-room room service / joule-moq-room, every target (pull_request) Successful in 1m48s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 2m10s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 27s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 10m5s
wai-pack / wai-pack · linux (pull_request) Successful in 1m26s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 18m57s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 3m13s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 3m59s
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backends (pull_request) Has been cancelled
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · macos (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
wai-pack / wai-pack · linux-arm64 (pull_request) Has been cancelled
wai-pack / wai-pack · macos (pull_request) Has been cancelled
wai-pack / wai-pack · independent verifier (Python) (pull_request) Has been cancelled
wai-pack / wai-pack · the floor through a media prober (pull_request) Has been cancelled
wai-pack / wai-pack · dependency licences (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
e3616f4e38
The linear-time check failed on a loaded linux-arm64 runner with both figures
about ten times their usual size (10000 attributes 10.8 ms, 40000 181 ms):
on a virtual machine a thread's CPU clock also counts the time the host held
the virtual CPU, so a busy host slows every run of one size before the other
is timed. Taking the two in turn lets a busy spell slow both alike, and seven
runs each make the least of each the run it disturbed least. The bounds are
unchanged: a reader that scans the names read so far still fails them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dash_read_bounds: 1000 attributes against 32000, bound at 256 times
Some checks failed
wai-pack / wai-pack · linux (pull_request) Has been cancelled
wai-pack / wai-pack · linux-arm64 (pull_request) Has been cancelled
wai-pack / wai-pack · macos (pull_request) Has been cancelled
wai-pack / wai-pack · independent verifier (Python) (pull_request) Has been cancelled
wai-pack / wai-pack · the floor through a media prober (pull_request) Has been cancelled
wai-pack / wai-pack · dependency licences (pull_request) Has been cancelled
WAI energy receipts / does this change touch it (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI conformance / does this change touch it (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Has been cancelled
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · macos (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Has been cancelled
standards workspaces build + test / which workspaces this change touches (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backends (pull_request) Has been cancelled
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Has been cancelled
joule-moq-web browser client / joule-moq-web · does this change touch it (pull_request) Has been cancelled
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Has been cancelled
joule-moq-room room service / joule-moq-room · does this change touch it (pull_request) Has been cancelled
joule-moq-room room service / joule-moq-room, every target (pull_request) Has been cancelled
a4784fc68f
Interleaving was not enough: the linux-arm64 runner failed it again at
40000 against 10000 (120 ms, 11 ms). Linear reading of the larger element
costs up to about three times more per attribute when its sets leave a cache
a busy host shares, which puts linear near 12 times and a quadratic reader
at 16: too close to bound. With sizes 32 apart, linear is 32 times (about
100 with that cache effect) and quadratic about a thousand, and the bound
sits between them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!400
No description provided.