You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Project display units: fold the UnitsElem read into the definitions pass (#1237) #1816
#1796 reads the project's display units with a pass of its own over every partition: native_project_units::resolve calls native_document::extract_graphs with selected_classes: {"UnitsElem"} (src/research/native_project_units.rs:104-110 at c016643b). A default export already decodes that record in the definitions pass. storey_properties::read (src/ifc/mod.rs:3524) goes through native_element_parameters::read_own_defined, which builds the memoised definitions (native_document.rs:600-608). That pass feeds a UnitsElem root to definitions.ingest_units(graph) (native_document.rs:658-665), which reads the same m_units.m_formatOptionsMap (native_parameter_definitions.rs:353-356). Folding the units read into it is #1237's rule. The PR measured the extra pass at 91 ms or less (Snowdon Towers Architectural), once per export, so this did not hold #1796.
Done when
The units come from the definitions pass where it runs, and from their own pass only where it does not. Every export stays byte for byte as it is, and the time of one export of the largest saves is measured before and after (timing=true).
Found by a Tendrils review worker (DeepSeek) and checked by rvtDevelop.
The fold, and its rows before any run. Branch perf/1816-units-from-definitions, 3c9eb5c8.
What changes.
The definitions pass keeps what each UnitsElem it decodes gives the units read, in walk order (native_project_units::units_of).
native_project_units::read looks for a definitions pass the handle already holds under its own options' key. If one is there, it replays those outcomes and stops at the first error, as its own walk does. If none is there, it walks as before.
The read never makes the pass itself. The pass costs more than the read it would save, and the handle holds one pass, so making it would evict another reader's.
registry.ingest_units is untouched.
Why the result cannot move. A definitions pass made with the read's budgets (the default budgets, NATIVE_RELEASES, no graph classes) sees the same current UnitsElem records the read selects, in the same partition order. It also builds them whole: binding_context_fields limits only Family and FamilySymbol.
Rows, against main97397b9e, in one Measure run: the samples of every year, the BIM4LCA models, the R2025 set, rac_advanced and the held-out models, with timing=true and the probe probe_1816_units_from_definitions:
Unchanged. Every ifc.sha256 and every file Measure compares, each model's diagnostics included, equals main's. The units reach the output only through the diagnostics (recovered_unit_identifiers, project_display_units, the read's error), so the diagnostics are the row that can see a change.
Mechanism (probe). Two conditions:
On every model the probe reads, the folded read equals the read's own walk (equal=true), whether the result is units, None or an error.
On every reference model and every sample of Revit 2024 to 2027, the export's read takes the held pass (export units_reads held=1 walked=0). A model where it walks is named, with the read that came between or the reason no definitions pass came first. If any 2024 to 2027 model walks, the fold is not what this PR says it is, and it is read again before landing.
Run 43291861101 at 3c9eb5c8, read against the rows above: row 2 fails, so the fold is not what the PR said it was.
Unchanged. All 125 models' ifc.sha256 equal main's (97397b9e), and so does every one of the 101 diagnostics.json the run keeps (the held-out and racadv shards keep none). The scorer diff lists only what the head side alone writes. Holds.
Mechanism. Fails.
The fold itself is right: on all 101 models the probe reads, the folded read equals the read's own walk (fold source=held equal=true).
But the export took the held pass on one model only, Einhoven (export units_reads held=1 walked=0). On the other 100, Core Interior and every 2024 to 2027 sample among them, it walked (held=0 walked=1).
Time. Not read: the head's export walks just as main's does, so this table says nothing about the fold.
Why it walked.apply_partition_level_storeys drops the definitions pass on purpose right after the storey read (rf.forget_native_definitions(), src/ifc/mod.rs:3528), so that the rest of the export does not hold it. recover_project_units runs about 110 lines later, after that drop. On Einhoven a pass was still held when the units were read, but I have not read why. The review of this PR missed the drop.
Fix, bb1ad607. The storey step reads the project's units, which the handle memoises, just before it drops the pass. recover_project_units then takes the memo, and the drop stays where it is. main (45471a31, with #1817) is merged in as 6ec32fbb, so that the time is judged against the same index code.
The rows above stand unchanged for the new head. Run 43298644195 measures 6ec32fbb against main with the same models, probe and timing.
Done by #1821, which was merged without closing this. Against the "done when":
Units from the definitions pass where it runs, their own pass only where it does not. On every reference model and every Revit 2024 to 2027 sample the export's read takes the held pass. The exception is the four rst_basic saves of 2024 to 2027: no Level record is accepted there, so apply_partition_level_storeys returns before the storey read makes the definitions pass, and the units read walks, as this issue asks for a file where the pass does not run. The folded read equals the read's own walk on all 202 probe outputs.
Every export byte for byte as it is. All 125 ifc.sha256 and every kept diagnostics.json equal main's.
Time measured. Over the 28 samples of 2023 to 2027, the median ratio is 0.99, the slowest 1.02, and none over 1.03.
The figures are in #1821's description, from Measure 43298644195.
Activity
DrunkOnJava commentedon Nov 12, 2026
The fold, and its rows before any run. Branch
perf/1816-units-from-definitions,3c9eb5c8.What changes.
UnitsElemit decodes gives the units read, in walk order (native_project_units::units_of).native_project_units::readlooks for a definitions pass the handle already holds under its own options' key. If one is there, it replays those outcomes and stops at the first error, as its own walk does. If none is there, it walks as before.registry.ingest_unitsis untouched.Why the result cannot move. A definitions pass made with the read's budgets (the default budgets,
NATIVE_RELEASES, no graph classes) sees the same currentUnitsElemrecords the read selects, in the same partition order. It also builds them whole:binding_context_fieldslimits onlyFamilyandFamilySymbol.Rows, against
main97397b9e, in one Measure run: the samples of every year, the BIM4LCA models, the R2025 set, rac_advanced and the held-out models, withtiming=trueand the probeprobe_1816_units_from_definitions:Unchanged. Every
ifc.sha256and every file Measure compares, each model's diagnostics included, equalsmain's. The units reach the output only through the diagnostics (recovered_unit_identifiers,project_display_units, the read's error), so the diagnostics are the row that can see a change.Mechanism (probe). Two conditions:
equal=true), whether the result is units,Noneor an error.export units_reads held=1 walked=0). A model where it walks is named, with the read that came between or the reason no definitions pass came first. If any 2024 to 2027 model walks, the fold is not what this PR says it is, and it is read again before landing.Time, as a check that nothing got slower, not as a saving claimed. fix(ifc): the project's display units are read from its UnitsElem, one per spec, and units of specs the IFC does not assign are no longer reported as unmapped (RE-439) #1796 measured the read at 91 ms or less, well under the run-to-run spread of a 25 to 40 s export. The bars:
main;Where
main's rounds of a file fall into two values, as Snowdon Towers HVAC's peak does, the time is judged on the lowest and the highest rounds.perf(ifc): the export reads the display units before the storey read …
DrunkOnJava commentedon Nov 12, 2026
Run 43291861101 at
3c9eb5c8, read against the rows above: row 2 fails, so the fold is not what the PR said it was.ifc.sha256equalmain's (97397b9e), and so does every one of the 101diagnostics.jsonthe run keeps (the held-out andracadvshards keep none). The scorer diff lists only what the head side alone writes. Holds.fold source=held equal=true).export units_reads held=1 walked=0). On the other 100, Core Interior and every 2024 to 2027 sample among them, it walked (held=0 walked=1).main's does, so this table says nothing about the fold.Why it walked.
apply_partition_level_storeysdrops the definitions pass on purpose right after the storey read (rf.forget_native_definitions(), src/ifc/mod.rs:3528), so that the rest of the export does not hold it.recover_project_unitsruns about 110 lines later, after that drop. On Einhoven a pass was still held when the units were read, but I have not read why. The review of this PR missed the drop.Fix,
bb1ad607. The storey step reads the project's units, which the handle memoises, just before it drops the pass.recover_project_unitsthen takes the memo, and the drop stays where it is.main(45471a31, with #1817) is merged in as6ec32fbb, so that the time is judged against the same index code.The rows above stand unchanged for the new head. Run 43298644195 measures
6ec32fbbagainstmainwith the same models, probe and timing.perf(research): the project's display units come from the definitions…
research: an opt-in ledger keeps every native pass a thread makes, wi…
DrunkOnJava commentedon Nov 14, 2026
Done by #1821, which was merged without closing this. Against the "done when":
rst_basicsaves of 2024 to 2027: no Level record is accepted there, soapply_partition_level_storeysreturns before the storey read makes the definitions pass, and the units read walks, as this issue asks for a file where the pass does not run. The folded read equals the read's own walk on all 202 probe outputs.ifc.sha256and every keptdiagnostics.jsonequalmain's.The figures are in #1821's description, from Measure 43298644195.