Skip to content

perf(research): the saved-graphics pass builds only the fields meshing reads (#1694) - #1717

Merged
DrunkOnJava merged 3 commits into
mainfrom
perf/1694-saved-graphics-fields
Nov 11, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
perf/1694-saved-graphics-fields

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

The saved-graphics pass builds only the fields of a graph that meshing reads (Options::graph_fields, the projection #1335 added for the walls, levels, pipes and ducts). No export changes: 125 of 125 exports of an unfiltered Measure are byte-identical. The pass's peak memory falls 6% to 10% and a default export's 3% to 7% (0.93 to 1.00 times on one runner); the registered bar of 0.85 is missed, and the next lever is read on the issue (a pointer value is a three-entry map of about 730 bytes).

Motivation

#1694: after #1691 and #1701 the default export's peak memory on Revit 2023 to 2027 files is still 1.3 to 2.5 times 0.17.0's. The dhat run of the pass (42996084734) puts 77% to 87% of its peak in the decoded graph nodes (class_in, field_as, a map entry with its own key String, about 150 bytes each, 1.33 million on rst_basic 2023), and the pass reads a small part of what a graph holds. Rows were registered on #1694 before the runs.

Changes

  • src/research/native_saved_scene.rs: SAVED_GRAPHICS_FIELDS, the 66 m_ names (keys inside a field's value included, and m_id) that the seven modules reading a graph object between a graphics record and a mesh use as string literals (native_saved_mesh, native_graphics_traversal, native_parametric_mesh, native_parametric_surface, native_empty_faces, partition_instance_transforms and this one), and saved_graphics_fields, which both extraction paths (extract_impl, extract_in_batches_with_control) set as graph_fields. decode_graph_projected reads and checks every field as the full decode does and builds only the listed ones, so a graph is refused for the same reasons and a field left out reads as absent. None of those modules iterates a graph's fields or reads a qualified (Declaring::name) key.

Testing

Measured on the Measure runner, no local build. Rows registered before the runs on the issue, read on the issue; head af2d861c against main a0dd7813:

run what read
43026045106 unfiltered, every flag row 1 held: 125 of 125 exports byte-identical; same-project gates pass
43026049770 timing, 2023 and 2024 samples, offices, reference models (29 files) row 2 missed: peak 0.93 to 1.00 (rac_basic 2023 0.96, Snowdon Architectural 0.97, offices 0.96 to 0.97; 0.85 asked); row 3: time 0.98 to 1.03 on 28 files, rac_advanced 2023 1.05
43026053891 probe_1075_heap_sites, Autodesk's 2023 samples row 4 missed: the decode is 75%, 75% and 86% of the pass's peak (from 86%, 77%, 87%; 50% asked); the peak falls 166.1 to 155.5, 309.1 to 279.6, 233.8 to 213.9 MiB
  • tools/check-local.sh: no local build here; the PR's own CI runs fmt, clippy, rustdoc and the test matrix
  • Verified end to end on real Revit files: the rows above

Audit-honesty checklist

  • Docs reflect what ships: no capability changes; the memory cost is the issue's table, which the 0.18.0 notes state
  • A user-visible change has its fragment (changelog.d/changed/1694-saved-graphics-fields.md)
  • Commit messages say what and why
  • No emojis; no private paths

Legal and contribution hygiene

  • Apache-2.0; no Autodesk proprietary source or NDA'd SDK content
  • No fixtures added

Breaking changes

None expected: row 1 is that no export moves.

Related issues

Refs #1694.

…g reads (#1694)

The dhat run of the pass on Autodesk's samples of Revit 2023 put 77% to 87% of its peak in the decoded graph nodes, and meshing reads a small part of what a graph holds. The pass now sets Options::graph_fields to the 66 m_ names the seven modules that read a graph object between a graphics record and a mesh use (decode_graph_projected reads and checks every field as the full decode does and builds only these).
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 11, 2026 13:40
@DrunkOnJava
DrunkOnJava merged commit b647c60 into main Nov 11, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/1694-saved-graphics-fields branch November 11, 2026 13:53
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… modules it serves (#1694) (#1721)

## Summary

A check in the PII guard job holds `SAVED_GRAPHICS_FIELDS` (#1717)
against the `"m_..."` string literals of the seven modules that read a
graph object between a graphics record and a mesh, and fails with the
names when they differ. The constant's doc comment now says so and names
the one reader the check cannot see.

## Motivation

#1717 made the saved-graphics pass build only the listed fields, so a
reader that takes another field reads it as absent. Measure's
`ifc.sha256` catches that only on routes some export reads; the pre-2023
route and any branch no model exercises are outside it. In the review of
#1717 I extracted the literals by hand (65 in the seven modules, equal
to the list less `m_id`); this makes it a contract check instead of a
hand count. It is a check of a file against a file, not a unit test.

## Changes

- `tools/ci/saved-graphics-fields.py`: reads the constant from
`src/research/native_saved_scene.rs` and every `"m_..."` literal of the
seven modules (the constant's own body excluded). Fails naming each
literal a reader takes that the list lacks and each listed name no
reader takes, except `m_id`, which the decode's identity check reads.
- `.github/workflows/ci.yml`: a step in the PII guard job, after the API
doc ids check.
- `src/research/native_saved_scene.rs`: the doc comment only. It says CI
fails when the names differ, and that `default_representation` in
`native_graphics_traversal.rs` depends on the count of an object's
fields, not a name: a pre-2023 `InstanceInfo` with no `m_GRepId` is the
default representation only if it holds exactly `m_Trf`, `m_symbolId`
and `m_cda` (RE-342; the 30 sample projects of 2015 to 2022 declare
exactly those three, and no export reads that route).

## Testing

Unit tests are banned in this repository: none added. Run end to end on
the sources:

- [ ] `full / CI passed` on the final head
- [x] On `main` at `b647c60b` the check exits 0: `saved-graphics fields:
66 names, every literal of 7 readers listed`.
- [x] On a copy of the sources with `m_radius` removed from the list and
a new literal added to `native_empty_faces.rs` it exits 1 and names both
(`m_brandNewField is read by native_empty_faces.rs and not in
SAVED_GRAPHICS_FIELDS`, `m_radius is read by
native_parametric_surface.rs, native_saved_mesh.rs and not in
SAVED_GRAPHICS_FIELDS`).
- [x] The workflow file parses (`yaml.safe_load`), the step is in the
PII guard job, `tools/ci/api-doc-ids.py` passes and `rustfmt --check` is
clean on the one Rust file.

## Audit-honesty checklist

- [x] No user-visible change, so no changelog fragment; no claim in
README or docs changes.
- [x] No emojis, no private paths in committed files.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary source, internals or NDA
material.
- [x] No new test fixtures.

## Breaking changes

None.

## Related issues

Refs #1694.
DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…to serde_json::Value, and a probe that sizes it on real graphs (#1694) (#1793)

## Summary

A compact value for a decoded graph's fields,
`rvt::research::graph_value::Fv`, and a probe that sizes it on real
graphs. `Fv` holds what a `serde_json::Value` holds with an object's
values in one slice and its field names once for every object that has
them; `Fv::from_json` and `Fv::to_json` are exact (number kinds, key
order and all). Nothing reads a graph through it yet: this prices the
one lever left on #1694 before a reader is touched, and the readers move
only if the probe's rows hold. It changes no export.

## Motivation

#1694: after levers (c) (#1717) and (e) (#1731), 75% to 87% of the
saved-mesh pass's peak is decoded graph nodes, and what makes them large
is the container: a `BTreeMap` leaf is 631 bytes however few fields it
holds, every key is a heap `String`, and a pointer (an object of three
numbers) costs about 730 bytes. Levers (d) and (f) kept `serde_json`'s
object map and were worth 3% to 8% of the export's peak, so the issue
left a typed compact value, "a refactor of its own". The rows it must
meet are on the issue before the probe runs:
#1694 (comment)

## Changes

- `src/research/graph_value.rs` (new, declared in `src/research.rs`):
`Fv` (null, bool, `U64`, `I64`, `F64`, string, array, object), `Obj`,
`NameTable` (the lists of names objects share), `Fv::from_json`,
`Fv::to_json`, `Fv::get`, `Fv::node_count`. Failure-first tests of the
pure conversion: a number keeps the kind `serde_json` held it in (`1`
and `1.0` differ, `u64::MAX`, `i64::MIN`, negative zero), an object
keeps `serde_json`'s key order, empty and odd containers and strings
survive, objects with the same names share one list and others do not,
two lists with the same letters are two lists, `get` and `node_count`.
- `probes/examples/probe_1694_compact_graph.rs` (new): decodes every
native record of a file one at a time, counts the live heap bytes of the
decoded graph, of a clone of its objects' `fields` (a floor for today's,
since a clone is built whole) and of their conversion, and compares the
round trip on every object; exit status 1 where it differs.

## Testing

- [x] Fast CI green on the head (fmt, clippy with `-D warnings`, the lib
tests including the six conversion tests).
- [ ] `full / CI passed` on the final head (nothing uses the module, so
the exports cannot move).
- [x] The probe on 14 files
([43113426587](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43113426587)),
read against the rows on the issue ([comment
6811556407](#1694 (comment))):
`Fv` holds 0.157 to 0.185 of a clone of today's heap bytes (0.20 asked),
4,276,161 objects round-trip with 0 mismatches.

## Audit-honesty checklist

- [x] No user-visible change: a research module and a probe, no
changelog fragment.
- [x] No reverse-engineering finding.
- [x] No emojis, no private paths in committed files.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary source, internals or NDA
material.
- [x] No new test fixtures.

## Breaking changes

None. `unstable-research` only.

## Related issues

Refs #1694.
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