Repository navigation
perf(reader): Revit 2015 to 2023 exports take 0.54 to 0.78 of main's time, byte-identical (#1237) - #1333
Merged
Conversation
…opies no field for a container's items, and keeps no field spans a graph never reads (#1237)
…ecords that hold a definition's id, and the types only when a type's value is used (#1237)
…es where the schema has the measured layout, and by the graph decoder otherwise (#1237)
…'s time, byte-identical (#1237)
…is keyed by its definition's id and where that is measured, and the changelog scopes byte identity to 2015 to 2023 (#1237)
Merged
9 tasks done
…on the merged head, every model and sample (run 41793618569) (#1237)
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 08:21
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 08:21
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
…e and head on one runner (#1343) ## Summary Measure's `timing` job is sharded by file. The build runs once, then four shards of about equal time each time base and head on a runner of their own, and a merge job puts their tables into the one table the single job wrote. A change in the shards' numbers is the proof run's. ## Motivation With `-f timing=true` the single "Timing (one runner)" job built both refs and exported every model, office file and sample three times each with both builds, in turn, on one runner. On run 41793618569 the other shards finished in 12.4 minutes and that job took 37 (07:37:59 to 08:14:57), so it was the long pole of every perf PR's Measure run. From run 41255129905's medians the files take about 44 minutes (base plus head, three rounds), the offices 12 of them and the 2024 samples 11. The rule that keeps a ratio honest stays: base and head of a file are timed in turn on the same runner (runner CPUs differ by up to about a quarter), so each shard times both for its own files. ## Changes - `.github/workflows/measure.yml` - `plan` outputs `timing`: the files as units with seconds that are their files' medians, base plus head, times three rounds, summed from the proof run 41797994751's table (the reference models 71, the four office files 329 when `nordic`, the samples as year ranges: to 2023 461, 2024 559, 2025 286, 2026 216, 2027 on 207, each cut to `sample_years`), packed into at most four shards largest first. With the inputs of a full run the shards weigh 559, 532, 536 and 502 s of 2,129. The proof run's four shards ran on four CPUs and no runner's rows skew clearly (its units took 0.98 to 1.21 of their time on run 41793618569's one runner), so the weights are not normalised. - `timing-build` builds `rvt-ifc` at both refs once (the cache, checkouts and build of the old job, unchanged) and uploads the two binaries as `timing-bin`. - `timing` is a matrix of the shards: it downloads the binaries (artifacts do not keep the executable bit, so it sets it), fetches only its files, runs `tools/ci/measure-timing.sh` on them and uploads `measure-timing-shard-N` (its table and its runner's CPU). - `timing-merge` puts the shards' rows into one table in the old format and order (the models, then the samples by name), writes the step summary with each shard's CPU, and uploads `measure-timing` with `timing.md` as before, plus `timing-runners.txt`. A shard that left no table fails this job after the others are merged. - The `timing` input's description says what it now does. - `CONTRIBUTING.md`: the Measure paragraph says the files are timed in shards and to compare ratios, not times, between rows. - No change to `tools/ci/measure-timing.sh`, which times what it is given. ## Testing Unit tests are banned in this repository: none added. - [x] `yaml` parses (`YAML.safe_load`), `actionlint` reports the one finding `main` has (`uses: $/.github/actions/fetch-corpus`, line 630 here, 588 there) and none new; file modes unchanged (100644). - [x] The planner, extracted from the workflow and run with seven input combinations (full, no offices, models only, `sample_years` 2015 2023 / 2026 2027 / 2025, timing off): every sample year and file is in exactly one shard, a range is cut to `sample_years`, and timing off gives the placeholder row. - [x] Proof, Measure run 41797994751 (`-f base=main -f samples=true -f nordic=true -f timing=true -f models="-" -f scorers=none`, dispatched from this branch, whose code differs from `main`'s by this workflow alone). Every job succeeded. - Shape: `timing.md` has the old header, 68 rows (the 10 models and offices and the 58 samples, the same 68 files as the old single job's table in run 41793618569) and the same order; the artifact is still `measure-timing`. - Ratios: head / base 0.96 to 1.02, mean 1.002, the totals 354.6 s and 355.2 s (1.002); 67 of 68 files within 0.97 to 1.03, the exception `Terrain_Concrete_BuildingPermit`, 0.96 (a small export). Peak memory 0.98 to 1.04 (`2015-rme_basic` 1.04: the same code on both sides). - Time: from the first job's start to the merge job's end 14 min 39 s, against the old single job's 36 min 58 s in run 41793618569 (0.40). Timing build 175 s; shards 356 s (offices), 572 s (samples 2024), 589 s (samples 2025 and 2026 and the reference models), 690 s (samples to 2023 and 2027 on); merge 6 s. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR: `CONTRIBUTING.md` is updated. - [x] Not a user-visible change: no changelog fragment (as #1317, #1319). - [x] No emojis, no private paths. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`). - [x] No Autodesk proprietary source, decompiled internals, or NDA'd SDK content. - [x] No fixtures. ## Breaking changes None to the code. The `measure-timing` artifact keeps its name and `timing.md` keeps its table; the job named "Timing (one runner)" is now "Timing", with "Timing N (what)" shards and "Timing build" beside it. ## Screenshots or output samples The step summary names each shard's runner, and `timing-runners.txt` in the artifact has them: ``` - shard 1 (offices): Intel(R) Xeon(R) 6975P-C - shard 2 (samples 2024): Intel(R) Xeon(R) 6973P-C - shard 3 (samples to 2023, samples 2027 on): AMD EPYC 7763 64-Core Processor - shard 4 (samples 2025, samples 2026, reference models): INTEL(R) XEON(R) PLATINUM 8573C ``` The four CPUs differ, which is what a ratio taken on one runner for each file is for: the same code reads 0.96 to 1.02 on all of them. First rows of the merged table: ``` | file | base (ms) | head (ms) | head / base | base peak (MiB) | head peak (MiB) | peak head / base | |---|---:|---:|---:|---:|---:|---:| | 2024_Core_Interior | 5891 | 5933 | 1.01 | 309 | 308 | 1.00 | | ARK_NordicLCA_Office_Concrete_As-Built | 26916 | 26859 | 1.00 | 919 | 919 | 1.00 | ``` The proof run's first weights (from run 41255129905) were off: the planner weighed the four office files at 720 s and they took 356, and the shard of samples to 2023 and 2027 on ran on the slower AMD runner, 690 s. The weights are now the proof run's own per-file times, which pack to 559, 532, 536 and 502 s (the planner run locally for the full, no-offices and `sample_years` cases: every unit lands in exactly one shard, one shard has the reference models and one the offices). No second proof run: only the weights changed, not the shapes; this PR's own Measure run checks that the workflow parses. ## Related issues None. Found while running #1333's unfiltered Measure.
Closed
7 of 8 tasks
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
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 exportmaintakes 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.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 namedIsExternal, 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 2015rme_advanced, 516 of 6,724 records hold one).rac_advanced;decode_basewas 425 of its 485 ms, mostly a scan of every class for the nameElementand a JSON object for each of 20 fields and 17 nested objects.FamilySymbolrecords 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 (aClassPlan, kept per decode), copies noFieldfor 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::namedfinds a class through an index built on first use, not by scanning every class.src/research/native_element.rs:decode_basereads 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 withdefinition_filterleaves 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 (anIdentifier: 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_valuesreplacesread_defined_values. It reads the types the elements name only if a definition the reader takes a type value for (a plainIsExternal) 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.tools/fetch-autodesk-samples.sh, never stored; terms inresearch/autodesk-sample-projects.tsv). The exports are compared withmain's: no Revit export is the oracle, since the change is meant to leave every value as it was.ifc.sha256anddiagnostics.jsonof 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 againstmainat 2bfccab, every job succeeded) equalmain'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).refs/archive/2026-11-04/scratch/1237-timings-3, Measure 41782852434, samples 2015 to 2027): 1,014,473 records compared by their fullElementBase(pointers, offsets, ids, flags,end), 0 differences, 0 fallbacks, all 58 exports exit 0. That branch'sread_baseis byte-identical to this head's: a diff ofsrc/research/native_element.rsbetween the two shows only the comparison lines.timingjob, the median of three exports each, alternating order: the merged head ea69551 againstmainat 2bfccab on one runner (run 41793618569), and 6f387fd against v0.11.0 on another (run 41782874568); compare ratios, not seconds, between the two runs.main's in run 41793618569, so its observations do not change.tools/bench.sh: not rerun. It timesrvt-info,rvt-schema,rvt-historyandrvt-analyzeon the family corpus, none of which runs these passes, and rewritesdocs/data/bench-2024.*.Reproduce, naming the commit (the workflow comes from
main):Time, this change against
mainand against 0.11.0Against
main: the merged head ea69551, thetimingjob 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.main(s)mainmainThe 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 /
mainis 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.main(ms)mainReference 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 ofmain's; Core Interior is the 1.04 (309 to 322 MiB), against 1.01 in run 41782871819, which hadmainbefore #1329.The Element base reader's own effect: 2015
rac_advancedwent from 0.73 to 0.63 ofmain's time andrst_basicfrom 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
FamilySymboldefinitions read, the wall records, what is left of the phase pass, and the preamble.The definitions pass's full
FamilySymboldecode (117 ms of 1,775 on 2015rac_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):FamilySymbolandFamilyrecord in full (117 and 18 ms), but reads two root fields of them (m_idandm_familyIdorm_categoryId). A root-only read would ingest a record whose full decode fails and which the pass now skips, sosymbol_familiescould differ. Not done, since it is not value-neutral;SWallgraphs (180 records, 700,000 values);Audit-honesty checklist
docs/status.mdalready saysmainis ahead by the fragments.changelog.d/changed/.Legal and contribution hygiene
CONTRIBUTING.md).CLEANROOM.md).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_valuesis replaced byread_property_values;native_document::Optionsgainsfiltered_parameters_only;native_parametersgainsSpansanddecode_object_fields_spanning;schema_registry::Registrygains a private field (it is built only byparse).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) and1237-timings-3(a57e12a, the Element base comparison).