Skip to content

perf(reader): Revit 2015 to 2023 exports take 0.54 to 0.78 of main's time, byte-identical (#1237) - #1333

Merged
DrunkOnJava merged 10 commits into
mainfrom
perf/1237-native-passes
Nov 4, 2026
Merged

DrunkOnJava merged 10 commits into
mainfrom
perf/1237-native-passes

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

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.
  • 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.
  • 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).
  • 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.
  • 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.
  • 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):

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

  • README / docs reflect the current state after this PR: no capability changes; docs/status.md already says main is ahead by the fragments.
  • A user-visible change has its entry as a fragment under changelog.d/changed/.
  • Not applicable: no limitation resolved or added. The read of the parameters named for a property reads fewer records and the same values.
  • Commit messages say what changed and why.
  • No emojis in code, docs, or commit messages.
  • No private paths, personal email addresses, or internal jargon in committed files.
  • Not a reverse-engineering finding.

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0 (see CONTRIBUTING.md).
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see CLEANROOM.md).
  • 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).

…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)
…is keyed by its definition's id and where that is measured, and the changelog scopes byte identity to 2015 to 2023 (#1237)
…on the merged head, every model and sample (run 41793618569) (#1237)
@DrunkOnJava DrunkOnJava changed the title perf(reader): Revit 2015 to 2023 exports take 0.57 to 0.84 of main's time, byte-identical (#1237) perf(reader): Revit 2015 to 2023 exports take 0.54 to 0.78 of main's time, byte-identical (#1237) Nov 4, 2026
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 4, 2026 08:21
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 4, 2026 08:21
@DrunkOnJava
DrunkOnJava merged commit efc0cc4 into main Nov 4, 2026
29 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/1237-native-passes branch November 4, 2026 08:30
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exports of Revit 2015 to 2023 files take 1.6 to 3.9 times as long as with 0.11.0

1 participant