Skip to content

perf(research): the owners that name nothing are meshed 5,000 graph objects at a time, not 20,000, which takes 16% off Core Interior's peak memory (#1694) - #1731

Merged
DrunkOnJava merged 3 commits into
mainfrom
perf/1694-owner-budget
Nov 11, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
perf/1694-owner-budget

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

The saved-graphics pass meshes the owners that name no shared symbol (walls, beams, columns) a buffer of 5,000 graph objects at a time instead of 20,000. The buffer, about 95 MiB at the old size, was the pass's peak on a file whose walls fill it: Core Interior's export peak falls 516 to 434 MiB and the BIM4LCA office's about 3%. The owners are read once however often the buffer is meshed, so it costs no time and no export changes.

Motivation

#1694: the default saved meshes of 0.18.0 raised peak memory 1.4 to 4.4 times on Revit 2023 to 2027 files. This is the one of the levers read there that costs nothing; the others (a smaller symbols' batch, an index-backed JSON object, pointers as arrays) were measured and do not land.

Changes

  • OWNER_OBJECT_BUDGET 20,000 to 5,000 (src/research/native_saved_scene.rs) and its doc comment.
  • changelog.d/changed/1694-owner-buffer.md.

Testing

timing (43035891042: both builds on one runner, three rounds, 29 files, main b647c60b against the change), peak memory over main's: Core Interior 0.84 (516 to 434 MiB), the office as built 0.96 and at permit 0.97 (1,249 to 1,205 and 1,375 to 1,329), the timber office 0.99 and 0.98, every other file 0.96 to 1.05, which is the runs' noise on files it cannot move (rst_basic 2023 reads 1.00: its owners never fill 5,000 objects). Time 0.91 to 1.03 on all 29.

Exports: the unfiltered Measure (43042302840, every flag, keep_ifc, against main 8ec2ac98) reads 126 of 126 exports byte-identical (ifc.sha256), semantic diff passes on 42 models and same-project gates pass. The pass visits elements in another order with the buffer, which the export does not depend on (visit receives elements "in no set order").

The rows and the rest of the levers are on #1694: #1694 (comment)

Refs #1694

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 11, 2026 15:26
@DrunkOnJava
DrunkOnJava merged commit dae660b into main Nov 11, 2026
109 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/1694-owner-budget branch November 11, 2026 15:35
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