Repository navigation
perf(research): the project's display units come from the definitions pass where the handle holds it (#1816) - #1821
Merged
Conversation
… pass where the handle holds it (#1816) native_project_units::read walked every partition for the UnitsElem records although a default export has already made the parameter definitions pass, which decodes every UnitsElem (#1237's rule: fold a read into a pass that already selects its records). The definitions pass now keeps what each UnitsElem gives the units read (native_project_units::units_of), in walk order, its error as text. read peeks the pass the handle holds under its own options' key (native_document::held_definition_units) and replays those outcomes, stopping at the first error as its own walk does. It never makes the pass itself: that costs more than the read it would save and would evict another reader's pass from the handle's single slot. Where no such pass is held, it walks as before. registry.ingest_units is left as it is. native_project_units::read_counts counts which way each read went, and probe_1816_units_from_definitions compares the folded read with the read's own walk on a real file.
…drops the definitions pass, so they come from it (#1816)
This was referenced Nov 12, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 12, 2026
…ostics moved, the scorer residue, the probe's lines and the timing ratios (#1830) ## Summary Measure's run summary now opens with its verdict, so its reader no longer downloads both sides' results to learn which exports moved: - how many models' `ifc.sha256` and `diagnostics.json` equal the base's, naming the ones that differ (the scorer diff leaves both files out); - whether the scorer diff holds anything beyond what the head side alone writes (each model's `probe.txt`, its `probe: exit N` line, and `areas_across_saves*`), with the first such lines; - with a probe, its lines counted across the models, and any model whose probe did not exit 0. A timed run opens its timing table with a timing verdict: - the median, lowest and highest head / base time and peak, for the models, the samples of Revit 2023 to 2027 and those of 2015 to 2022; - the three longest-running files and the three with the highest peak; - every file more than 3% slower, or more than 2% higher in peak. Both are also in the job log and in small artifacts (`measure-verdict`, and `timing-verdict.md` in `measure-timing`), for a reader without the summary page. ## Motivation Every Measure run is read for the same figures, and they were computed by hand each time: five times on 11-12 alone (#1813, #1818, #1821, #1823 and the 0.14.1 hotfix). Neither script judges a pull request's registered rows. They print what the rows are written in. ## Changes - `tools/re/measure_verdict.py`: the export verdict over the merged `measure-head` and `measure-base` directories and `scorer-diff.txt`. - `tools/re/timing_verdict.py`: the timing verdict over the merged `timing.md`. It computes each ratio from the medians, not from the table's rounded ratio column. - `.github/workflows/measure.yml`: - the compare job checks the first script out with its other tools, makes the scorer diff before the summary, prints the verdict at its top, and uploads `measure-verdict`; - the timing job checks the second script out first and prints its verdict above the table. ## Testing Unit tests are banned here. Both scripts were run on the results of real runs and compared with what had been read by hand: - **#1821's run 43291861101:** 125 of 125 exports and 101 of 101 diagnostics identical, no scorer residue, and the probe's `export units_reads held=0 walked=1` on 100 models and `held=1` on one. This is the read that found #1821's dropped pass. - **#1694's C2 timing, 43288830617:** the 28 samples of Revit 2023 to 2027 at a median of 0.998, `rac_basic` 2023 at 1.070 and 2027 at 1.050, and 2021 `rst_basic`'s peak at 1.023. These match comment 6834180051. - **A scorer diff with two added lines and an extra file:** reported as 3 lines in 2 files, with the head-only output still left out. - **No base, a missing head and a missing table:** each prints a plain line and does not fail the job. The rehearsal is run [43304266907](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43304266907), dispatched from this branch on two models, timed, with a probe. Its summary, job logs and both artifacts are read before this is marked ready. `tools/ci/check-workflows.py`: 0 errors, 0 warnings. ## Breaking changes None.
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 21:31
DrunkOnJava
added a commit
that referenced
this pull request
Nov 12, 2026
#1821 split the definitions pass's key into definition_key and added held_definition_units. definition_pass keeps the ledger's caller argument beside the new key function, and a units read that the held pass answers is noted as 'definitions held', so the ledger still names every reader of the definitions.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 12, 2026
…th the line that asked for it, and probe_pass_ledger lists a default export's (#1837) ## Summary This adds an opt-in ledger of native passes, and a standing probe that prints it after a default export. `native_document::record_passes()` starts keeping one `PassEntry` for each of: - every `extract` and `extract_graphs` walk this thread makes; - every use of the handle's parameter-definitions pass: made, held, replaced by another key's, or dropped. Each entry carries: - the caller's file and line, from `#[track_caller]`, so no call site changes; - the value source, the channels, the size and a fingerprint of the selection, and whether the walk was uncached; - the partitions walked, the bytes inflated, the records emitted and the time. `take_passes()` returns the entries and stops keeping them. `probe_pass_ledger` prints each pass, then the totals, every selection read more than once (with its callers), and any definitions pass made again after the export dropped it. ## Motivation This came from an advisor review of where time spent now keeps paying off. Three of 11-12's pull requests each wrote a counter of their own to prove a fold (`walk_inflated_bytes` for #1694, `read_counts` for #1816, `wall_read_passes` for #1824). #1816's first Measure failed because a memo was dropped before its reader. The ledger shows that directly as `remade ... after dropped at ...`, and it shows the next fold's target as a repeated selection, without a counter written for it. ## Changes - `src/research/native_document.rs`: - `PassEntry`, `record_passes` and `take_passes`, and a thread-local that holds nothing until a probe turns it on; - `extract`, `extract_graphs` and `definition_captions` are `#[track_caller]`; - the definitions pass notes held, replaced and made. - `src/reader.rs`: `forget_native_definitions` notes a dropped pass, and `holds_native_definitions` says whether one is held. - `probes/examples/probe_pass_ledger.rs` and `changelog.d/research/pass-ledger.md`. ## Testing Unit tests are banned here. Measure [43307975040](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43307975040) runs `75613fd0` against its merge-base with `main`, `1a9aacc7`. It covers the samples of every year, the BIM4LCA models, the R2025 set, `rac_advanced` and the held-out models, with the probe on each. Rows, registered before the run: 1. **Exports unchanged.** Every `ifc.sha256` and `diagnostics.json` equals the base's. With the ledger off, as in every export, a pass checks one thread-local and does nothing else. 2. **The ledger sees the export.** - On every model the probe reads, it exits 0 and lists at least one walk. - On a Revit 2015 to 2023 sample it lists `definitions made` once, with `held` for the readers that share the pass. - Where the storey read runs, it lists `definitions dropped` at `src/ifc/mod.rs`. On `main` the units read walks after that drop, so a later `extract_graphs` selecting `UnitsElem` appears; #1821 removes it. **Read.** Both rows hold. 1. 125 of 125 `ifc.sha256` and 101 of 101 `diagnostics.json` equal the base's, and no scorer output moved. 2. All 202 probe outputs exit with the summary and list at least one walk. - Every Revit 2015 to 2023 sample lists `definitions made=1`, with `held` 1 or 2. - `definitions dropped` at `src/ifc/mod.rs` is on 192 of the 202 outputs. The ten without it are the 2024 to 2027 `rst` samples and Einhoven. - The `UnitsElem` walk at `native_project_units.rs` follows the drop, as predicted for code before #1821. **Merge of `main` (`dbff466f`).** #1821 split the pass's key into `definition_key` and added `held_definition_units`. `definition_pass` keeps the caller argument beside the new key function. A units read that the held pass answers is noted as `definitions held`, so once #1821 is in, the ledger shows that read in place of the walk above. With the ledger off, the merge's only change to the code above is #1821's, which `main` measured. No new Measure. `rustfmt --check` passes. CI runs clippy, the MSRV check and the docs. ## Breaking changes None. The new items are under `rvt::research`, which is `unstable-research`.
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.
Summary
native_project_units::readnow takes the project's display units from the parameter definitions pass the handle already holds, rather than walking every partition for theUnitsElemagain. Where no such pass is held, it walks as before. Exports and diagnostics are meant to be unchanged.Motivation
#1816. #1796 read the units with a pass of its own (91 ms or less on Snowdon Towers Architectural), although a default export has already made the definitions pass, which decodes every
UnitsElem. #1237's rule is to fold a read into a pass that already selects its records.Changes
src/research/native_document.rs:DefinitionPass.unitskeeps eachUnitsElem's outcome (native_project_units::units_of) in walk order, its error kept as its{:#}text;definition_keyis factored out ofdefinition_pass, so the exhaustive destructure stays in one place;held_definition_unitspeeks the pass the handle holds under an options' key, without making one.src/research/native_project_units.rs:units_ofis the read's per-record body, factored out;readreplays the held pass's outcomes (stopping at the first error, as its own walk does) or walks;read_countsis a thread-local count of which way each read went, for the probe.probes/examples/probe_1816_units_from_definitions.rs:changelog.d/changed/1816-units-from-definitions.md.The read never makes the definitions pass itself. It costs 0.4 to 0.9 s, more than the read, and the handle's one slot would lose another reader's pass.
Registry::ingest_unitsis untouched.Testing
Rows registered on #1816 before the run (comment):
main's.Measure 43291861101 at
3c9eb5c8failed row 2. Every model's read walked, because the storey read dropped the definitions pass before the units were read;bb1ad607reads them first. The rows are judged on the rerun, Measure 43298644195, at this head (6ec32fbb) againstmainateaf22753, the merge's parent. It covered nordic, r2025, samples, racadv and holdout, withtiming=trueand the probe:ifc.sha256and 101 of 101diagnostics.jsonequalmain's. The scorer diff holds only output the head alone writes: probe output andareas_across_saves*.equal=true, all exit 0). The export's read took the held pass on every reference model and every 2024 to 2027 sample exceptrst_basic2024 to 2027 (4 files,held=0 walked=1).apply_partition_level_storeysreturns before the storey read makes the definitions pass, and the units read walks, as it did before this change.rac_advanced), and none is over 1.03. The peaks are 1.00 to 1.02, the 1.02 on the concrete office at permit (1,018 to 1,042 MiB). This is not a claim of a saving.tools/check-local.sh: CI is the compiler here; the draft runs fast CI.tools/bench.sh.Audit-honesty checklist
changelog.d/changed/.probes/examples/.Legal and contribution hygiene
Breaking changes
None.
read_countsis a new public research function, behindunstable-research.Screenshots or output samples
The probe's counts are posted with the run.