Skip to content

perf(research): the saved-graphics pass of a default export walks the partitions without the handle's inflated copies (#1694) - #1813

Merged
DrunkOnJava merged 9 commits into
mainfrom
perf/1694-uncached-saved-graphics
Nov 12, 2026
Merged

DrunkOnJava merged 9 commits into
mainfrom
perf/1694-uncached-saved-graphics

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

The saved-graphics pass of a default export walks the partitions without the handle's inflated copies, which were 36% to 43% of the peak resident memory of the largest files at that stage (#1694). Draft until the Measure read: whether the repeated inflation costs less than the memory it frees is a measurement, and its rows are registered on #1694 (comment).

Motivation

#1694 after 0.19.0: the peak memory of the three largest files is 0.76 to 0.79 of 0.18.0's against the 0.70 the issue asked for, and the heap-stage read put the rest in the inflated partitions the handle keeps.

Changes

  • Options::uncached_partitions (native_document.rs): a read that walks a partition's stored segments, inflating each as it is met, with the read's whole group budget.
  • RevitFile::release_inflated_partitions (reader.rs).
  • extract_in_batches_with_control (native_saved_scene.rs) sets the option and releases the copies first.
  • changelog.d/changed/1694-uncached-saved-graphics-walks.md.

Testing

Pending the Measure read (rows on #1694) and full / CI passed on the final head.

Related issues

Refs #1694.

… partitions without the handle's inflated copies (#1694)

Options::uncached_partitions walks a partition's stored segments and inflates each as it is met; the batched saved-graphics read sets it and releases the handle's copies first. Draft: the timing job decides whether the repeated inflation costs less than the memory it frees.
…s only the groups that hold its records (#1694)

The probe of 1958414 shows why the record index left #1813 at 1.32x:
on Snowdon Towers Architectural one partition holds 444 MB of the
file's 444 MB inflated, so every read visits it and inflated all of it.

- native_segments::walk_selected asks a `wanted` predicate at each
  group's first segment and does not inflate a group it refuses; its
  markers, flags, channel, content key and checkback are still checked.
  walk_inflated delegates with every group wanted.
- The record index keeps each record's group start. A read with
  uncached_partitions and an index inflates only the groups holding a
  selected record, every copy of it.
- The pass indexes channel 103 with a read that selects nothing while
  the handle still holds the copies, then lets them go.
- native_document::walk_inflated_bytes counts what the walks inflate
  themselves; probe_1694_group_sizes prints it over the file's bytes
  after a default export.
… uncached option says why a skipped group is not checked (#1694)
DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…partitions holding a record it selects, from a record index of its own channel (#1694) (#1817)

## Summary

Each read of the saved-graphics pass visits only the partitions that
hold a record it selects (#1694). The handle's record index answers that
without a walk, but it held only the elements' records (channel 102),
and a read used it only when it selected the default channels. The
saved-graphics pass reads channel 103 alone, so every one of its reads
walked every partition twice, once to find its records and once to
decode them, whatever it selected. The handle now keeps an index for
each channel a read selects alone, built by the first such read. This is
a draft until the timing read; the rows are registered on #1694
([comment](#1694 (comment)),
run A).

## Motivation

#1813's timing run showed the pass's reads costing far more than the
batches select. Reading the code put the cause here, and #1813 depends
on it.

## Changes

- `RevitFile` keeps one record index per channel
(`native_record_indexes`, `native_record_index_of`).
`native_record_index()` is channel 102's, as before, so element
provenance and the type parameters' record starts read exactly what they
did.
- `extract_records` (`native_document.rs`) uses, and on its first read
builds, the index of the one channel a read selects, under the same
budget and unread-partition conditions as before.
- `changelog.d/changed/1694-graphics-record-index.md`.

## Testing

Pending: the timing run (43277786356) against the rows, an unfiltered
run for the exports on the final head, and `full / CI passed`.

## Related issues

Refs #1694. #1813 holds this change merged with its uncached walks.
…ved-graphics

# Conflicts:
#	src/research/native_document.rs
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 12, 2026 20:22
@DrunkOnJava
DrunkOnJava merged commit 1a9aacc into main Nov 12, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/1694-uncached-saved-graphics branch November 12, 2026 20:47
DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…ostics moved, the scorer residue, the probe's lines and the timing ratios (#1830)

## Summary

Measure's run summary now opens with its verdict, so its reader no
longer downloads both sides' results to learn which exports moved:

- how many models' `ifc.sha256` and `diagnostics.json` equal the base's,
naming the ones that differ (the scorer diff leaves both files out);
- whether the scorer diff holds anything beyond what the head side alone
writes (each model's `probe.txt`, its `probe: exit N` line, and
`areas_across_saves*`), with the first such lines;
- with a probe, its lines counted across the models, and any model whose
probe did not exit 0.

A timed run opens its timing table with a timing verdict:
- the median, lowest and highest head / base time and peak, for the
models, the samples of Revit 2023 to 2027 and those of 2015 to 2022;
- the three longest-running files and the three with the highest peak;
- every file more than 3% slower, or more than 2% higher in peak.

Both are also in the job log and in small artifacts (`measure-verdict`,
and `timing-verdict.md` in `measure-timing`), for a reader without the
summary page.

## Motivation

Every Measure run is read for the same figures, and they were computed
by hand each time: five times on 11-12 alone (#1813, #1818, #1821, #1823
and the 0.14.1 hotfix). Neither script judges a pull request's
registered rows. They print what the rows are written in.

## Changes

- `tools/re/measure_verdict.py`: the export verdict over the merged
`measure-head` and `measure-base` directories and `scorer-diff.txt`.
- `tools/re/timing_verdict.py`: the timing verdict over the merged
`timing.md`. It computes each ratio from the medians, not from the
table's rounded ratio column.
- `.github/workflows/measure.yml`:
- the compare job checks the first script out with its other tools,
makes the scorer diff before the summary, prints the verdict at its top,
and uploads `measure-verdict`;
- the timing job checks the second script out first and prints its
verdict above the table.

## Testing

Unit tests are banned here. Both scripts were run on the results of real
runs and compared with what had been read by hand:

- **#1821's run 43291861101:** 125 of 125 exports and 101 of 101
diagnostics identical, no scorer residue, and the probe's `export
units_reads held=0 walked=1` on 100 models and `held=1` on one. This is
the read that found #1821's dropped pass.
- **#1694's C2 timing, 43288830617:** the 28 samples of Revit 2023 to
2027 at a median of 0.998, `rac_basic` 2023 at 1.070 and 2027 at 1.050,
and 2021 `rst_basic`'s peak at 1.023. These match comment 6834180051.
- **A scorer diff with two added lines and an extra file:** reported as
3 lines in 2 files, with the head-only output still left out.
- **No base, a missing head and a missing table:** each prints a plain
line and does not fail the job.

The rehearsal is run
[43304266907](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43304266907),
dispatched from this branch on two models, timed, with a probe. Its
summary, job logs and both artifacts are read before this is marked
ready. `tools/ci/check-workflows.py`: 0 errors, 0 warnings.

## Breaking changes

None.
DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
… stable rvt API (#1836)

## Summary

The `semver checks` job already lists the stable `rvt` API at the base
and at the head (`cargo public-api`), but it reads only the removed
lines. It now also reports the items the head adds. They go in the job
log, a `::notice::` on the pull request's checks, and a section of the
job summary, at most 200 lines. An addition is never a failure.

## Motivation

An item added to the stable API is kept through 1.x once it ships
(RELEASE.md, "What 1.0 keeps stable"). #1813 added `pub fn
RevitFile::release_inflated_partitions`, which only `rvt::research`
calls. That was caught only because a reviewer read carefully, and it is
now `pub(crate)`. With this change, such an addition shows on the pull
request without anyone looking for it.

## Testing

Unit tests are banned here. The new block was run on its own, with that
exact item as the one line the head adds:
- the log listed the item, and `Public items the head adds (1)`;
- the notice was printed;
- the summary section was written;
- it exited 0.

`bash -n` passes. The count uses `grep -c ''`, since `wc -l` pads its
number on macOS. This pull request's own `semver checks` run, once it is
ready, adds nothing to the API, so its section stays empty: the real
test of the wiring.

## Breaking changes

None.
DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…s walls keeps their top joins, so the export does not read every wall's record again for them (#1824) (#1828)

## Summary

On Revit 2015 to 2023, `native_walls_and_top_joins_into` already reads
each wall's whole `SWall` or `ArcWall` record and finds whether its top
is joined. It now leaves that answer in `WallReads`, as it already does
with the type ids and the load bearing. In the same pass it reads the
walls with no type in the export, for their type id, top join and load
bearing alone. `read_wall_records` and `attach_wall_top_joins` then find
every wall's answer there, instead of reading every wall's record again.
This is part (1) of #1824. Part (2), the `GStyleElem` read and its
release question, is not taken here.

## Motivation

#1824 (1): two passes read the same wall records for
`m_wall_top_joined`. The second pass, `WallReads::read` from
`read_wall_records`, selects every wall only to find the top join the
first had read. The one consumer (`export_content.rs`) takes the first
value.

The first run showed that keeping the top joins was not enough.
`attach_wall_layers` asks the whole-record read only for the walls with
a type in the export, since only they get layers. The later readers ask
every wall, so a file with any typeless wall still made the second pass.

## Changes

- `src/research/native_walls.rs`:
- `native_walls_and_top_joins_into` extends `reads.top_joined` with the
top joins it read, and `reads.top_joins_read` with those walls only.
- It takes `facts_only`: walls read in the same pass for their type id,
top join and load bearing, and left out of the records it returns. A
facts-only wall counts as read only where its record was read.
- Per-thread counts of the passes `WallReads` makes (`wall_read_passes`)
and of the facts-only walls read (`wall_facts_only_reads`), for the
probe.
- `src/research/partition_schema_mvp/walls.rs`: `attach_wall_layers`
passes the walls with no type in the export as `facts_only`.
- `probes/examples/probe_1824_wall_top_joins_once.rs`: the passes and
the facts-only walls of the default export, and the top joins read both
ways on fresh handles: the whole record (`native_walls_and_top_joins`)
and the projected graph (`WallReads::top_joins`).
- `changelog.d/changed/1824-wall-top-joins-once.md`.

## Testing

Unit tests are banned here. The evidence is one unfiltered Measure of
this head against `main`, timed, with the probe on every model. It
covers the samples of every year, the BIM4LCA models, the R2025 set,
`rac_advanced` and the held-out models.

**The first run, 43302451503 on `b49ebda5`**, was read against the rows
below in their first form:
- Row 1 held: 125 of 125 exports and 101 of 101 diagnostics were equal.
- Row 2 held: 202 of 202 probe outputs were equal.
- Row 3 failed. Only the 11 `rst` samples of 2015 to 2023 made no pass.
All 22 `rac` and `rme` samples made one, and on each one every wall's
whole graph decoded. The cause was the typeless walls above.
- Its timing does not count. Its base, `main` at `1a9aacc7`, was not in
the head, so head against base also compared #1813's saving, which the
head lacked. That is where its peak readings of 1.08 to 1.49 came from.

This head merges `main` (at `8421e655`) and adds `facts_only`.

Rows, registered before the second run:

1. **Unchanged.** Every `ifc.sha256`, every `diagnostics.json` the run
keeps and every scorer file equal `main`'s.
2. **The same value both ways.** On every model the probe reads,
`top_joins ... equal=true`.
3. **No second pass.** On every sample of Revit 2015 to 2023, `export
wall_read_passes=0`. A sample with a pass is named, with the walls the
pass read and why the first read did not cover them. `facts_only` is
reported per sample.
4. **Time.** Over the samples of Revit 2015 to 2023, the median head /
`main` time is 1.00 or less, and no file is above 1.03. Where `main`'s
rounds of a file fall into two values, each mode is judged on its own.
5. **Memory.** No file's peak is above 1.03 of `main`'s. A typeless
wall's whole graph is now built where its projected graph was.

- [x] `rustfmt --edition 2024 --check` passes. CI runs the rest of the
gate.
- [ ] Verified end to end on real Revit files: the Measure run above.
- N/A: no exporter output changes (row 1).
- [ ] Performance change: the timing table of the same run (rows 4 and
5).

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR
- [x] A user-visible change has its entry as a fragment under
`changelog.d/<section>/`
- N/A: no limitation resolved or introduced
- [x] Commit messages describe 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] The probe under `probes/examples/` states its FACT

## Legal and contribution hygiene

- [x] I agree this work is licensable under Apache-2.0
- [x] This PR contains no Autodesk proprietary source, decompiled
internals, or NDA'd SDK content
- [x] No new test fixtures

## Breaking changes

None to the stable API. `wall_read_passes` and `wall_facts_only_reads`
are new public functions under `rvt::research`, which is
`unstable-research`. `native_walls_and_top_joins_into` takes a new
`facts_only` argument.
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.

1 participant