Repository navigation
research: an opt-in ledger keeps every native pass a thread makes, with the line that asked for it, and probe_pass_ledger lists a default export's - #1837
Merged
Conversation
…th the line that asked for it, and probe_pass_ledger lists a default export's
…'s time once (#1694) The extract's clock started before the definitions pass, so when the pass made them, its walk's time was in both "definitions made" and "extract", and the probe's total counted it twice. The clock now starts after the definitions.
#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
marked this pull request as ready for review
November 12, 2026 22:32
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
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 onePassEntryfor each of:extractandextract_graphswalk this thread makes;Each entry carries:
#[track_caller], so no call site changes;take_passes()returns the entries and stops keeping them.probe_pass_ledgerprints 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_bytesfor #1694,read_countsfor #1816,wall_read_passesfor #1824). #1816's first Measure failed because a memo was dropped before its reader. The ledger shows that directly asremade ... 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_passesandtake_passes, and a thread-local that holds nothing until a probe turns it on;extract,extract_graphsanddefinition_captionsare#[track_caller];src/reader.rs:forget_native_definitionsnotes a dropped pass, andholds_native_definitionssays whether one is held.probes/examples/probe_pass_ledger.rsandchangelog.d/research/pass-ledger.md.Testing
Unit tests are banned here. Measure 43307975040 runs
75613fd0against its merge-base withmain,1a9aacc7. It covers the samples of every year, the BIM4LCA models, the R2025 set,rac_advancedand the held-out models, with the probe on each. Rows, registered before the run:ifc.sha256anddiagnostics.jsonequals the base's. With the ledger off, as in every export, a pass checks one thread-local and does nothing else.definitions madeonce, withheldfor the readers that share the pass.definitions droppedatsrc/ifc/mod.rs. Onmainthe units read walks after that drop, so a laterextract_graphsselectingUnitsElemappears; perf(research): the project's display units come from the definitions pass where the handle holds it (#1816) #1821 removes it.Read. Both rows hold.
ifc.sha256and 101 of 101diagnostics.jsonequal the base's, and no scorer output moved.definitions made=1, withheld1 or 2.definitions droppedatsrc/ifc/mod.rsis on 192 of the 202 outputs. The ten without it are the 2024 to 2027rstsamples and Einhoven.UnitsElemwalk atnative_project_units.rsfollows the drop, as predicted for code before perf(research): the project's display units come from the definitions pass where the handle holds it (#1816) #1821.Merge of
main(dbff466f). #1821 split the pass's key intodefinition_keyand addedheld_definition_units.definition_passkeeps the caller argument beside the new key function. A units read that the held pass answers is noted asdefinitions 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, whichmainmeasured. No new Measure.rustfmt --checkpasses. CI runs clippy, the MSRV check and the docs.Breaking changes
None. The new items are under
rvt::research, which isunstable-research.