Repository navigation
perf(reader): the graph decoder borrows the schema's classes, and the named-parameter read decodes only the types its elements name (#1237) - #1301
Merged
Conversation
…of cloning them for each object (DrunkOnJava#1237) Cursor::class cloned every class of an object's lineage from the registry, with all its fields and their names, for each object a graph decodes. Every native pass decodes its records through it, so it was paid on every release. The lineage now borrows the registry's classes. Byte-identical IFC and diagnostics on the 2015 and 2019 rac_advanced and rme_advanced samples, RE1 Architecture, the 2025 rac_basic sample, Snowdon Towers Structural and 2024 Core Interior. Exports of those 2015 and 2019 samples are 9.9% to 11.1% faster than main at 7fd339e.
… their elements name (DrunkOnJava#1237) read_defined_values selected every FamilySymbol and system type record by class, and decoded each one's graph, though an element takes type values only from the type its record names (master_symbol). It now reads the elements' records first, then the records of the types they name. A named record of no type class is skipped, as the class selection skipped it. Its one caller, the parameters named for a property, reads names, levels and values, never target_name, so what it attaches is the same. Byte-identical IFC and diagnostics on the files the first commit lists. Exports of the 2015 and 2019 samples are another 8.7% to 9.8% faster.
DrunkOnJava
enabled auto-merge (squash)
November 3, 2026 23:38
3 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 3, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 3, 2026
…sure #1301 against main before it, and keep the entries' caveats; the Core Interior witness and the synthetic fixtures from CI run 41741905380, only their version and verdict hashes changed
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
## Summary Release 0.13.0: rooms and spaces dependable on more files (SpaceOutlineSource on every IfcSpace, Revit 2026/2027 room outlines, unclosed room solids resolved, bodiless family spaces left out), Revit 2018 projects that exported nothing now export, Revit 2016-2023 export phase and design options, joined columns' Length, the BIM4LCA wall hatches' widths, multi-arrow roofs, the viewer's real progress and too-large message, streaming STEP output, a scaled inflate cap, and puzzbobb's decoder speed-up (#1301, merged into this branch once it lands). ## Changes - Version 0.12.2 -> 0.13.0 in Cargo.toml, rvt-py/Cargo.toml (and its `=` pin), rvt-wasm/Cargo.toml, tools/stream_evidence/Cargo.toml, viewer/package.json, CITATION.cff (version and date), Cargo.lock and fuzz/Cargo.lock. - `python3 tools/release/changelog.py assemble`: 18 fragments into `[0.13.0] — 2026-11-03`, with an introduction measured against 0.12.2 and "Upgrading from 0.12". - README: the latest release and the "Upgrading from" pointer. ## Testing - Measure 41733089463: `main` against v0.12.2, every reference model, the samples and the held-out models (scorer diff read for the introduction). A final run of this branch's head against v0.12.2 is cited here before merge. - The Core Interior witness observations and verdicts, and the synthetic fixtures, are refreshed from this PR's CI run before merge (only `witness_version`, the verdict hashes and the version strings should change). ## Audit-honesty checklist - [x] The introduction keeps each entry's "not yet measured" caveats (#1075's 202 MB model, #421's ElementIds, the door width rule's one building). - [x] No emojis, private paths or internal jargon. ## Legal and contribution hygiene - [x] Apache-2.0; no Autodesk proprietary source, decompiled internals or NDA'd SDK content. ## Breaking changes None in the stable API (`write_step_to` is new). Behaviour changes are listed under "Upgrading from 0.12". ## Related issues Refs #1260, #1261, #1262, #1075, #421, #1237, #1195, #810, #1203, #885.
Owner
|
Automated Claude Code review (the maintainer's review agent; it read the diff): no blocking items. Measure runs 41736361020 and 41740244025 found every export byte-identical against the branch's base, and on one runner Revit 2015 to 2023 samples export 5% to 19% faster, 2024 and 2025 samples 5% to 13%, and the BIM4LCA office 7% to 9%, with peak memory within 5%. It is in 0.13.0. Thank you, @puzzbobb. |
15 of 17 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
…time, byte-identical (#1237) (#1333) ## Summary Exports of Revit 2015 to 2023 files take 0.54 to 0.78 of the time they took on `main`, and all 111 exports of the unfiltered Measure (every Measure model: the offices, Core Interior, R2025, the held-out models and the samples of every year, run 41793618569) are byte-identical, IFC and diagnostics. Against 0.11.0 they now take 1.09 to 1.65 times as long, where 0.12.0 took 2.0 to 3.4 times. The cuts are in what the native passes read, not in what they decide. ## Motivation #1237: 0.12.0 added native record passes on Revit 2015 to 2023 and exports took 2 to 3.4 times as long. #1239, #1240, #1275 and puzzbobb's #1301 took off the first part (the definitions read once, no family or material records in the named-parameter read, no per-record digest, the decoder borrowing the schema, and only the types the elements name). This takes the next part. The stages that cost the time were measured first, with a timing line on each native pass and each export step (scratch commits, archived below), on the 33 sample projects of 2015 to 2023. ## What the profile found Autodesk's 2015 `rac_advanced`, whose export `main` takes 2.8 s on a quiet runner and 0.11.0 0.7 s. The profile runs export many files at once on one runner, so milliseconds are not comparable between the two runs; each step's share of its run's export is. | step | before (Measure 41777773390) | share | after the first three commits (41781975396) | share | |---|---:|---:|---:|---:| | parameter definitions pass | 560 ms | 13% | 236 ms | 13% | | named-parameter read: elements | 948 ms | 22% | 56 ms | 3% | | named-parameter read: types | 72 ms | 2% | none | | | phase read of every record | 485 ms | 11% | 284 ms | 16% | | wall records and wall types | 341 ms | 8% | 193 ms | 11% | | whole export | 4,251 ms | | 1,775 ms | | - The named-parameter read decoded 5,608 records and 6 of them held the id of a definition it reads (`ids=5608`, `decoded=5608`, `hits=6`, 646 of its 647 ms decode on records with none). It checked 64 accepted definitions in the file; none is named `IsExternal`, so no type value could be used and the 72 ms type read was never needed. A scratch check that every record contributing a parameter holds an id found 0 exceptions in all 33 samples (`violations 0`; in 2015 `rme_advanced`, 516 of 6,724 records hold one). - The phase read decodes the Element base of all 17,099 records of 2015 `rac_advanced`; `decode_base` was 425 of its 485 ms, mostly a scan of every class for the name `Element` and a JSON object for each of 20 fields and 17 nested objects. - The definitions pass decodes 400 `FamilySymbol` records for 117 ms, for two root fields. See "What remains". ## Changes - `src/research/native_parameters.rs`: the graph decoder builds a class's field keys once for each class a record uses (a `ClassPlan`, kept per decode), copies no `Field` for the items of a container, and keeps field spans only for the caller that reads one (`Spans`, `decode_object_fields_spanning`). - `src/research/schema_registry.rs`: `Registry::named` finds a class through an index built on first use, not by scanning every class. - `src/research/native_element.rs`: `decode_base` reads the Element base fields straight from the bytes where the schema has the layout its checks measured, and by the graph decoder, as before, for anything else (a field with flags, a class with a parent of its own, an unknown pointer class, a flag above 1, more than 1,024 constraint references, a short body). - `src/research/native_document.rs`: `Options::filtered_parameters_only`, which with `definition_filter` leaves out a selected record whose body does not hold the first four bytes of the id of any definition the filter accepts. It assumes a value is saved against its definition's id itself, a whole little-endian integer in the record (an `Identifier`: 4 bytes on 2015 to 2023, 8 from 2024), so that a record without the integer's first four bytes holds no value for the definition. That is measured, not proven: on the 33 samples of 2015 to 2023 every record that gave an accepted parameter held an id, and the exports of every Measure model are unchanged with the filter (run 41793618569, 111 exports). The definitions pass also asks once for each class tag whether it owns a definition. - `src/research/native_element_parameters.rs`, `src/research/partition_schema_mvp/parameters.rs`: `read_property_values` replaces `read_defined_values`. It reads the types the elements name only if a definition the reader takes a type value for (a plain `IsExternal`) exists; otherwise the read is as before, and so is the read on a file that defines one. - `changelog.d/changed/1237-native-pass-cuts.md`. ## Testing Unit tests are banned in this repository: none added. The change is shown on real files, end to end. - [ ] `tools/check-local.sh`: nothing is built on this Mac (no local compute); CI's fast jobs run the draft, the full set runs when it is marked ready. - [x] Verified end to end on Autodesk's sample projects, with the offices, Core Interior, R2025 and the held-out models for the exports (the unfiltered Measure, run 41793618569), and 58 samples of 2015 to 2027 for the Element base reader (fetched for the run by `tools/fetch-autodesk-samples.sh`, never stored; terms in `research/autodesk-sample-projects.tsv`). The exports are compared with `main`'s: no Revit export is the oracle, since the change is meant to leave every value as it was. - [x] Byte identity: `ifc.sha256` and `diagnostics.json` of all 111 exports of the unfiltered Measure (`-f base=main -f nordic=true -f r2025=true -f samples=true -f holdout=true -f timing=true`, every scorer; run 41793618569, the merged head ea69551 against `main` at 2bfccab, every job succeeded) equal `main`'s, 111 of 111: 30 models including R2025, the 4 office files, 19 held-out models and 58 samples. Earlier, the 33 samples of 2015 to 2023 at 0fdfd49 (run 41780471217) and at 6f387fd (run 41782871819). - [x] The Element base reader against the graph decoder, on every record the phase read decodes (scratch commit archived at `refs/archive/2026-11-04/scratch/1237-timings-3`, Measure 41782852434, samples 2015 to 2027): 1,014,473 records compared by their full `ElementBase` (pointers, offsets, ids, flags, `end`), 0 differences, 0 fallbacks, all 58 exports exit 0. That branch's `read_base` is byte-identical to this head's: a diff of `src/research/native_element.rs` between the two shows only the comparison lines. - [x] Time: Measure's `timing` job, the median of three exports each, alternating order: the merged head ea69551 against `main` at 2bfccab on one runner (run 41793618569), and 6f387fd against v0.11.0 on another (run 41782874568); compare ratios, not seconds, between the two runs. - [x] The witness verdicts replay: Core Interior's export is byte-identical to `main`'s in run 41793618569, so its observations do not change. - [ ] `tools/bench.sh`: not rerun. It times `rvt-info`, `rvt-schema`, `rvt-history` and `rvt-analyze` on the family corpus, none of which runs these passes, and rewrites `docs/data/bench-2024.*`. Reproduce, naming the commit (the workflow comes from `main`): ```bash gh workflow run measure.yml --ref main -f ref=ea69551f0cd4ac8a601547a61d7c718963904a1f -f base=main -f nordic=true -f r2025=true -f samples=true -f holdout=true -f timing=true gh workflow run measure.yml --ref main -f ref=6f387fd1155ed6ad1af3aed784c49c6926545e19 -f base=main -f samples=true -f sample_years="2015 2023" -f models="-" -f scorers=none -f timing=true gh workflow run measure.yml --ref main -f ref=6f387fd1155ed6ad1af3aed784c49c6926545e19 -f base=v0.11.0 -f samples=true -f sample_years="2015 2023" -f models="-" -f scorers=none -f timing=true ``` ### Time, this change against `main` and against 0.11.0 Against `main`: the merged head ea69551, the `timing` job of run 41793618569 (one runner for every file, the median of three exports each, base and head in turn). Against 0.11.0: 6f387fd in run 41782874568, on a runner of its own. Totals of the medians; compare ratios, not seconds, between the two runs. | group | files | `main` (s) | this PR (s) | PR / `main` | peak memory, PR / `main` | PR / 0.11.0 (run 41782874568) | |---|---:|---:|---:|---:|---:|---:| | samples 2015 | 6 | 17.6 | 10.9 | 0.62 | 0.87 to 0.97 | 1.49 | | samples 2016 to 2018 | 9 | 16.8 | 11.0 | 0.66 | 0.86 to 0.99 | 1.51 | | samples 2019 to 2022 | 15 | 35.4 | 23.0 | 0.65 | 0.84 to 0.98 | 1.47 | | samples 2023 | 3 | 7.4 | 5.1 | 0.69 | 0.96 to 0.99 | 1.13 | | samples 2024 to 2027 | 25 | 218.5 | 187.1 | 0.86 | 0.90 to 1.00 | | | reference models and 4 offices | 10 | 71.8 | 60.9 | 0.85 | 0.93 to 1.04 | 0.80 to 0.98 (the 6 reference models) | The issue's table for 0.12.0 against 0.11.0 (run 41228075400) was 3.37 for 2015, 2.9 to 3.0 for 2016 to 2018, 2.8 to 3.2 for 2019 to 2022 and 2.01 for 2023. Per sample, PR / `main` is 0.54 to 0.78 for 2015 to 2023 and 0.80 to 0.89 for 2024 to 2027; PR / 0.11.0 is 1.09 to 1.65 for 2015 to 2023. Over all 33 samples of 2015 to 2023 it is 1.43. | sample | `main` (ms) | PR (ms) | PR / `main` | PR / 0.11.0 | |---|---:|---:|---:|---:| | 2015 rac_advanced | 2,764 | 1,644 | 0.59 | 1.65 | | 2015 rac_basic | 1,662 | 1,279 | 0.77 | 1.26 | | 2015 rme_advanced | 5,242 | 3,285 | 0.63 | 1.50 | | 2015 rme_basic | 4,767 | 2,899 | 0.61 | 1.48 | | 2015 rst_advanced | 1,971 | 1,069 | 0.54 | 1.54 | | 2015 rst_basic | 1,161 | 701 | 0.60 | 1.58 | | 2019 rac_advanced | 2,892 | 1,758 | 0.61 | 1.51 | | 2019 rac_basic | 1,673 | 1,278 | 0.76 | 1.28 | | 2019 rme_advanced | 5,188 | 3,361 | 0.65 | 1.46 | | 2019 rme_basic | 4,748 | 2,984 | 0.63 | 1.48 | | 2019 rst_advanced | 1,943 | 1,155 | 0.59 | 1.47 | | 2019 rst_basic | 1,113 | 691 | 0.62 | 1.52 | Reference models and offices, PR / `main`: 0.84 Core Interior, 0.85 and 0.85 the two office files (30.3 s to 25.7 s and 27.0 s to 22.9 s), 0.86 and 0.84 the two terrain files, 0.87 RE1 Architecture, 0.83 Electrical, 0.86 Mechanical, 0.85 Plumbing, 0.75 Einhoven. Peak memory is 0.93 to 1.04 of `main`'s; Core Interior is the 1.04 (309 to 322 MiB), against 1.01 in run 41782871819, which had `main` before #1329. The Element base reader's own effect: 2015 `rac_advanced` went from 0.73 to 0.63 of `main`'s time and `rst_basic` from 0.83 to 0.63 between runs 41780471217 (without it) and 41782871819 (with it), where the whole export is 1.8 s and the phase read it replaces was 16% to 26% of that. ## What remains over 0.11.0 The remaining cost is 1.43 times 0.11.0's time over all 33 samples (1.49, 1.51, 1.47 and 1.13 by release group, single samples 1.09 to 1.65). The issue's done-when is met as written: the stages that cost the time are measured, each is cut, and the timing against 0.11.0 states what is left per release. The rest is tracked in #1335: the `FamilySymbol` definitions read, the wall records, what is left of the phase pass, and the preamble. The definitions pass's full `FamilySymbol` decode (117 ms of 1,775 on 2015 `rac_advanced`) is not cut here because a root-only read is not value-neutral. From the profile after the first three commits (2015 `rac_advanced`, 1,775 ms: definitions 236, wall records 173 of which the native preamble 45 and the first pass's record index 23, phase read 284 before the direct reader): - the parameter definitions pass decodes every `FamilySymbol` and `Family` record in full (117 and 18 ms), but reads two root fields of them (`m_id` and `m_familyId` or `m_categoryId`). A root-only read would ingest a record whose full decode fails and which the pass now skips, so `symbol_families` could differ. Not done, since it is not value-neutral; - the wall records' top joins and type ids read the `SWall` graphs (180 records, 700,000 values); - the preamble (schema, history, ElemTable, extensible-storage catalog) is read once, 45 ms. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR: no capability changes; `docs/status.md` already says `main` is ahead by the fragments. - [x] A user-visible change has its entry as a fragment under `changelog.d/changed/`. - [x] Not applicable: no limitation resolved or added. The read of the parameters named for a property reads fewer records and the same values. - [x] Commit messages say what changed and why. - [x] No emojis in code, docs, or commit messages. - [x] No private paths, personal email addresses, or internal jargon in committed files. - [x] Not a reverse-engineering finding. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`). - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`). - [x] No new fixtures. ## Breaking changes None to the stable API, the CLIs or any export (every Measure model, run 41793618569, 111 exports). `rvt::research` (unstable): `native_element_parameters::read_defined_values` is replaced by `read_property_values`; `native_document::Options` gains `filtered_parameters_only`; `native_parameters` gains `Spans` and `decode_object_fields_spanning`; `schema_registry::Registry` gains a private field (it is built only by `parse`). ## Screenshots or output samples N/A: IFC and diagnostics are byte-identical (above; every Measure model, run 41793618569, 111 exports). ## Related issues Closes #1237. Refs #1335, which tracks the remaining cost over 0.11.0. Credit to puzzbobb for #1301, which this goes on from, and for naming the same costs (the schema copy, the types decoded and never used, the per-record digest) in #1237's step-level profile. The profiling commits are archived at `refs/archive/2026-11-04/scratch/1237-timings` (bb0c048, per-pass timing and the check that a contributing record holds a definition's id), `1237-timings-2` (1187a65, the profile after the first three commits) and `1237-timings-3` (a57e12a, the Element base comparison).
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
Two more speed-ups for #1237, after #1239, #1240 and #1275. Each leaves every export byte-identical, IFC and diagnostics alike. Together they make exports of Autodesk's 2015 and 2019
rac_advancedandrme_advancedsamples 19% to 21% faster thanmainat 7fd339e, and 2024 to 2025 files 5% to 10% faster.Motivation
#1237: 0.12.0 exports Revit 2015 to 2023 files 1.6 to 3.9 times as slowly as 0.11.0. The step-level profile there puts most of the time in decoding records' graphs: 796 ms of the named-parameter pass on 2015
rac_advanced. This PR takes two of those costs:Cursor::class(native_parameters.rs) cloned each class of an object's lineage from the registry, every field and field name with it, for each object it decoded. Every native pass goes through it, on every release.read_defined_valuesselected everyFamilySymboland system type by class. An element only takes type values from the one type its record names (master_symbol), so on these samples most of those graphs were decoded and never used.Changes
src/research/native_parameters.rs:Cursor::classborrows its lineage from the registry (&'a Class) instead of cloning it.src/research/native_element_parameters.rs: a values read (Types::Values) selectsidsalone. A secondextractthen reads the types their records name that are not inids. Both extractions share one visitor, which takes the parameter map as an argument so the named types can be read from it in between. A named record of no type class is skipped there, as the class selection skipped it. The kept definition pass (perf(reader): native extraction reads the file's parameter definitions once per handle, not once per extraction (#1237) #1239) and the record index make the second extraction cheap.read_defined_values' doc says what it now leaves unfilled:target_namefor a type no element names. Its one caller,attach_native_named_parameters, reads names, levels and values, nevertarget_name.Testing
Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead.
tools/check-local.shpasses (fmt, clippy, rustdoc, build, real-file / CLI / contract checks)tools/bench.shand attached the before / afterGate.
tools/check-local.sh --corpuspasses on the branch's head: the family corpus at phi-ag/rvtbec25470and the project corpus at magnetar-io/revit-test-datasetsfd755e1, 282 integration tests. The first commit passescargo clippy --workspace --all-targets -- -D warningson its own.Same output.
rvt-ifc FILE -o out.ifc --diagnostics out.jsonwithSOURCE_DATE_EPOCH=1700000000,mainat 7fd339e and this branch both built--profile ci. Both files are byte-identical on:rac_advancedandrme_advancedsamples;rac_basicsample and Snowdon Towers Structural;Each commit was checked the same way on its own. Against Revit's export nothing moves, since nothing rvt-rs writes changes.
Witness. On 2024 Core Interior,
rvt-ifc --observationwith--artifact-id magnetar-2024-core-interiorand-slimgives the committedresearch/witness/*/observations/rvt-rs.jsonbyte for byte.Time.
hyperfine -N -w 1, median of 5 runs (3 for the 2025 files), one local machine,main7fd339e against this branch:mainrac_advancedrme_advancedrac_advancedrme_advancedrac_basicEach commit on its own, on the four 2015 and 2019 files:
Peak memory is not measured here. The first change can only lower it. The second reads fewer graphs, in two extractions where there was one. A Measure run would give both against 0.11.0, as #1237's "done when" asks.
tools/bench.shis not rerun. It timesrvt-info,rvt-schema,rvt-historyandrvt-analyzeon the family corpus, none of which runs these passes, and it rewritesdocs/data/bench-2024.*.Not done here, for a later PR:
Options::record_extras), butRecordstill carriesderived_default_ifc_guid,effective_ifc_parameterand their two diagnostics as public fields, which onlynative_saved_sceneturns on. Before perf(reader): native passes skip the digest, GUID and IFC parameter no reader uses, and a wall's type id and top join are read in one pass (#1237) #1275, removing the four fields and their derivation measured within ±1% on the four 2015 and 2019 files above, and was about 35 lines. It is an API removal, so it is left for whoever cleans upRecordbefore 1.0.Sha256::digest(..).iter().map(|b| format!("{b:02x}")), oneStringper byte, is still innative_segments,schema_registry(twice) andnative_es_catalog.native_document's privatelower_hexfrom perf(reader): native passes skip the digest, GUID and IFC parameter no reader uses, and a wall's type id and top join are read in one pass (#1237) #1275 would replace them if it were shared. Not timed.rac_advanced, measured at 895109d).Audit-honesty checklist
changelog.d/<section>/(seechangelog.d/README.md), not inCHANGELOG.mdprobes/examples/and a dated addendum todocs/rvt-moat-break-reconnaissance.mdare includedNo changelog fragment, as with #1239: a speed-up within a release that already states the slowdown, for the 0.12.1 notes to give against 0.11.0. Not a reverse-engineering finding.
Legal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md)testuser,111111,FY-20XX, etc.) and contain no real-world PIIBreaking changes
None. No public signature changes.
read_defined_valuesleavestarget_nameunfilled for a type no element ofidsnames, as its doc now says.Screenshots or output samples
N/A: no output changes (byte-identical, above).
Related issues
Refs #1237