Repository navigation
Description
Context
We consume rvt = "=0.14.0" behind an adapter and compare the decoded artifact exactly: tiles, element rows, properties, pixels, picks, and lifecycle. We cannot take the 0.18/0.19 default saved-mesh scope and exported-property changes as a performance-only bump. We are asking for a 0.14-compatible reader release, or a bounded/streaming saved_meshes::attach.
Measurements
Direct worker --stage pipeline, macOS arm64, 48 GiB host. Three fixtures:
| Fixture | Saved-attach candidates | 0.14.0 batch 128 | 0.14.0 unbatched |
|---|---|---|---|
| 122 MiB Revit 2024 | 2,820 | 3.158 GB / 13,980 ms | 6.789 GB / 10,330 ms |
| 190 MiB | 756 | 1.634 GB / 8,990 ms | 1.659 GB / 7,840 ms |
| 385 MiB | 1,114 | 3.202 GB / 14,450 ms | 3.310 GB / 10,130 ms |
The outer batching is ours; it trades wall for peak because the reader retains owner graphs.
0.14 owner-graph spike
We ported the 0.18 owner-graph retention path (#1690/#1691) to a scratch 0.14 copy: owners that name nothing are read again and meshed a buffer at a time; meshed owner graphs are released; owners another owner names are kept.
| Fixture | Baseline | 0.14 + owner-graph path | Artifact |
|---|---|---|---|
| 122 MiB, batch 128 | 3.158 GB / 13,980 ms | 1.916 GB / 15,250 ms | identical |
| 122 MiB, unbatched | 6.789 GB / 10,330 ms | 1.825 GB / 11,300 ms | identical |
| 190 MiB, unbatched | 1.659 GB / 7,840 ms | 1.654 GB / 7,920 ms | identical |
| 385 MiB, unbatched | 3.310 GB / 10,130 ms | 3.317 GB / 10,160 ms | identical |
Run unbatched, the 122 MiB fixture is 1.825 GB / 11,300 ms against our current 0.14 batch-128 path of 3.158 GB / 13,980 ms: lower peak and faster, identical artifact. This is the both-metrics lever.
#1701 alone is not enough
A scratch 0.14 copy with only #1701's planner, unbatched on the 122 MiB fixture, moved peak 6.789 → 6.699 GB (−1.8%) and wall 10,330 → 11,420 ms (+10.0%). The extra body-size walk costs more than the plan saves. #1701 is optional for us; the owner graphs are the holder.
Ask
- Primary: a 0.14-compatible patch release with the owner-graph retention path (Default saved meshes: peak memory is 1.4 to 4.4 times 0.17.0's on Revit 2023 to 2027 files, where #1191 measured up to 1.6 #1690/fix(research): the saved-mesh pass reads each owner's graph with the batch it is meshed in, so the default export no longer holds every wall's graph at once (#1690) #1691), or a bounded/streaming
saved_meshes::attachthat caps retained saved geometry without changing the artifact. - Fallback: a next-release opt-in that preserves 0.14's saved-mesh selection and artifact behavior.
0.19.0's changelog includes the owner-graph work, but its default export moves 107 of 126 measured exports and changes properties/quantities, so it is not a drop-in for an exact-artifact consumer.
0.14 port patch
The measured 216-line port is below; it is a scratch build against v0.14.0, not a request for you to accept this exact code. The 0.18 implementation is the reference.
0.14 owner-graph patch
--- a/src/research/native_saved_scene.rs 2006-07-24 11:21:28
+++ b/src/research/native_saved_scene.rs 2026-11-12 16:01:34
@@ -368,6 +368,36 @@
/// `control` is its too: [`Stage::SavedGraphics`] at 0 and then at 1 of 1
/// once the owners are read, then [`Stage::SavedMeshes`] at 0 and once for each
/// owner meshed, of the number of owners.
+/// The graph objects of the owners that name nothing that are held at once
+/// while they are meshed: the buffer is meshed and let go when it holds this
+/// many (the same 95 MiB or so as a batch of symbols).
+const OWNER_OBJECT_BUDGET: usize = 20_000;
+/// Mesh the owners of `buffer`, give each element to `visit` and let the graphs
+/// go.
+fn mesh_buffer(
+ buffer: &mut BTreeMap<u64, Record>,
+ run: &MeshRun<'_>,
+ visit: &mut impl FnMut(SavedElement) -> Result<()>,
+) -> Result<()> {
+ if buffer.is_empty() {
+ return Ok(());
+ }
+ let ids: Vec<u64> = buffer.keys().copied().collect();
+ let no_shared = BTreeMap::new();
+ let elements = mesh_elements(
+ &ids,
+ Records {
+ owners: &*buffer,
+ shared: &no_shared,
+ },
+ run,
+ )?;
+ for element in elements {
+ visit(element)?;
+ }
+ buffer.clear();
+ Ok(())
+}
pub fn extract_in_batches_with_control(
file: &mut RevitFile,
options: &Options,
@@ -384,25 +414,50 @@
let mut opts = options.clone();
opts.channels = BTreeSet::from([103]);
opts.record_extras = true;
+ // Everything each owner's graph names. An owner can name another owner,
+ // whose own symbols its mesh then reaches, as the one-shot read finds them
+ // by reading every record's references.
+ let mut owner_references = BTreeMap::<u64, Vec<u64>>::new();
let mut owners = BTreeMap::<u64, Record>::new();
native_document::extract_graphs(file, &opts, |r| {
+ let id = r.identity.element_id;
+ let references = instance_symbols(&r);
+ let names_something = !references.is_empty();
ensure!(
- owners.insert(r.identity.element_id, r).is_none(),
+ owner_references.insert(id, references).is_none(),
"duplicate current graphics owner"
);
+ // An owner that names nothing is not kept: its graph is its own
+ // geometry (a wall's is about 1.6 MiB, #1429, and a file has hundreds),
+ // and it is read again below and meshed a buffer of them at a time. One
+ // that names a symbol or an owner is kept, as every owner was, for the
+ // batch that meshes it with what it names.
+ if names_something {
+ owners.insert(id, r);
+ }
Ok(())
})?;
- // Everything each owner's graph names. An owner can name another owner,
- // whose own symbols its mesh then reaches, as the one-shot read finds them
- // by reading every record's references.
- let owner_references: BTreeMap<u64, Vec<u64>> = owners
+ // The owners another owner names: their graphs stay for the mesh of the one
+ // that names them. Every other owner's graph is freed once it is meshed.
+ let named_owners: BTreeSet<u64> = owner_references
+ .values()
+ .flatten()
+ .copied()
+ .filter(|symbol| owner_references.contains_key(symbol))
+ .collect();
+ // The owners that name nothing, and that no owner names: meshed in one
+ // further pass, before the batches.
+ let streamed: BTreeSet<u64> = owner_references
.iter()
- .map(|(&id, record)| (id, instance_symbols(record)))
+ .filter(|(id, references)| references.is_empty() && !named_owners.contains(*id))
+ .map(|(&id, _)| id)
.collect();
- // Each owner with the symbols it names that are not owners themselves,
- // ordered so that owners naming the same symbols are next to each other.
+ // Each of the other owners with the symbols it names that are not owners
+ // themselves, ordered so that owners naming the same symbols are next to
+ // each other.
let mut named: Vec<Named> = owner_references
.iter()
+ .filter(|(id, _)| !streamed.contains(*id))
.map(|(&id, references)| {
let symbols: BTreeSet<u64> = references
.iter()
@@ -413,7 +468,7 @@
})
.collect();
named.sort();
- let total = named.len() as u64;
+ let total = owner_references.len() as u64;
// The progress is the one-shot read's, whatever the batches: the graphics
// are reported read once the owners are, and each owner is reported meshed
// once, in order, against the same total.
@@ -429,6 +484,26 @@
done: &done,
total,
};
+ // The owners that name nothing are read in one pass and meshed a buffer of
+ // about 20,000 graph objects at a time, as they are read.
+ if !streamed.is_empty() {
+ let mut buffer = BTreeMap::<u64, Record>::new();
+ let mut held = 0usize;
+ opts.selected_ids = streamed;
+ native_document::extract_graphs(file, &opts, |r| {
+ held += r.graph.as_ref().map_or(0, |graph| graph.objects.len());
+ ensure!(
+ buffer.insert(r.identity.element_id, r).is_none(),
+ "duplicate current graphics owner"
+ );
+ if held >= OWNER_OBJECT_BUDGET {
+ mesh_buffer(&mut buffer, &run, &mut visit)?;
+ held = 0;
+ }
+ Ok(())
+ })?;
+ mesh_buffer(&mut buffer, &run, &mut visit)?;
+ }
let mut limit = FIRST_BATCH_SYMBOLS;
let mut next = 0;
let mut freeing: Option<std::thread::JoinHandle<()>> = None;
@@ -437,7 +512,10 @@
let mut ids = Vec::new();
let mut symbols = BTreeSet::<u64>::new();
while let Some((_, id, own)) = named.get(next) {
- if !ids.is_empty() && symbols.union(own).count() > limit {
+ // The owners that name no symbol sort first and make a batch that
+ // reads none, so that their graphs are gone before any symbol is.
+ let ends_symbol_free = symbols.is_empty() && !own.is_empty();
+ if !ids.is_empty() && (ends_symbol_free || symbols.union(own).count() > limit) {
break;
}
ids.push(*id);
@@ -462,6 +540,25 @@
&attempted,
&mut wanted,
);
+ // An owner the batch's owners name that names nothing was not kept (an
+ // owner that names something was): it is read now, and kept as it is
+ // named. An owner a symbol names is read with the symbols below.
+ let missing: BTreeSet<u64> = expanded
+ .iter()
+ .copied()
+ .filter(|id| !owners.contains_key(id))
+ .collect();
+ if !missing.is_empty() {
+ control.check()?;
+ opts.selected_ids = missing;
+ native_document::extract_graphs(file, &opts, |r| {
+ ensure!(
+ owners.insert(r.identity.element_id, r).is_none(),
+ "duplicate current graphics owner"
+ );
+ Ok(())
+ })?;
+ }
for depth in 0..=128 {
if wanted.is_empty() {
break;
@@ -479,6 +576,14 @@
);
Ok(())
})?;
+ // A symbol that names an owner whose graph was freed with an
+ // earlier batch (no owner names it, so it was not kept): the mesh
+ // looks it up among the shared records, so it is read again.
+ wanted.extend(found.iter().copied().filter(|id| {
+ owner_references.contains_key(id)
+ && !owners.contains_key(id)
+ && !attempted.contains(id)
+ }));
add_references(
found,
&owner_references,
@@ -503,12 +608,25 @@
for element in elements {
visit(element)?;
}
- limit = (BATCH_OBJECT_BUDGET.saturating_mul(shared.len().max(1)) / objects.max(1))
- .clamp(MIN_BATCH_SYMBOLS, MAX_BATCH_SYMBOLS);
+ // Only a batch of symbols sizes the next one.
+ if !symbols.is_empty() {
+ limit = (BATCH_OBJECT_BUDGET.saturating_mul(shared.len().max(1)) / objects.max(1))
+ .clamp(MIN_BATCH_SYMBOLS, MAX_BATCH_SYMBOLS);
+ }
+ // The batch's owners are meshed: their graphs go with its symbols,
+ // those another owner names excepted.
+ let meshed: Vec<Record> = ids
+ .iter()
+ .filter(|id| !named_owners.contains(*id))
+ .filter_map(|id| owners.remove(id))
+ .collect();
// Freeing the decoded graphs takes seconds on large models: do it
// aside where there are threads.
if workers() > 1 {
- freeing = Some(std::thread::spawn(move || drop(shared)));
+ freeing = Some(std::thread::spawn(move || {
+ drop(shared);
+ drop(meshed);
+ }));
}
}
Ok(())
Activity
DrunkOnJava commentedon Nov 12, 2026
Thanks for the measurements and the port. We'll ship this as 0.14.1, a patch release cut from
v0.14.0that changes nothing but the saved-mesh pass's memory.What goes in. Two fixes from
main, cherry-picked ontov0.14.0on branchhotfix/v0.14.1:be595556(fix(saved-graphics): the pass frees an owner's graph with its batch, so the walls that embed a curtain wall stop raising the export's peak (#1429) #1441): the pass frees an owner's graph with its batch, unless another owner names it.979ec428(fix(research): the saved-mesh pass reads each owner's graph with the batch it is meshed in, so the default export no longer holds every wall's graph at once (#1690) #1691): the owners that name nothing are let go after the first read, then read again and meshed a buffer of about 20,000 graph objects at a time.native_saved_scene.rson the branch then equals979ec428's, except for #1449's Revit 2015 to 2022 meshing, which 0.14 does not have. Nothing else from 0.15 to 0.19 comes in: not the default saved-mesh scope, not the property changes, not #1701.The fallback. An opt-in in a later release that keeps 0.14's selection and output is not planned. It would mean carrying two exporters.
Rows, registered before any run. Two Measure runs of the branch against
v0.14.0, with the branch's own (0.14) workflow and scorers: the samples of every year, the BIM4LCA models, BIMcollab and the held-out models.ifc.sha256and every scorer file equalv0.14.0's.--saved-meshesexport unchanged. With every boxed element drawn from its saved mesh, the attach you measure, every model'sifc.sha256equalsv0.14.0's.--saved-meshes. No file's peak resident memory is above 1.02 ofv0.14.0's. On the BIM4LCA office, as built and at permit, whose walls are owners that name nothing, it falls to 0.80 ofv0.14.0's or less. If neither office falls that far, the backport does not do on our files what your port did on yours, and it is read again before any tag.--saved-meshes. The median over the samples of Revit 2023 to 2027 is at most 1.10 ofv0.14.0's, and no file is above 1.25. The owners that name nothing are read twice, so some cost is expected. Your port measured +9% on the file where it saved the most.The branch also runs the full CI matrix that
mainruns. The tag goes on a commit that passed both. We'll post the numbers here, and once it is published, the version on each channel. 0.19.0 stays the latest release on every channel.chore(release): prepare v0.14.1: version files, the README's release …
DrunkOnJava commentedon Nov 12, 2026
The two runs against the rows above: three hold, and the peak row does not. No tag until it is understood.
Run A is 43299514100, the default export. Run B is 43299518912,
--saved-meshes, timed. Both measured3a70b639againstv0.14.0.Default export unchanged. Holds. 88 of 88
ifc.sha256and 69 of 69diagnostics.jsonequalv0.14.0's, and no scorer output moved.--saved-meshesexport unchanged. Holds. 88 of 88 and 69 of 69 again.Peak. Fails.
v0.14.0rac_basic2023rac_basicrise is steady over all three rounds: about 550,000 KiB onv0.14.0and 809,000 to 813,000 KiB on 0.14.1.main, fix(research): the saved-mesh pass reads each owner's graph with the batch it is meshed in, so the default export no longer holds every wall's graph at once (#1690) #1691's own run left 2023rac_basicunmoved. So the backport behaves differently on 0.14's tree, or under--saved-meshes.Time. Holds. The median of the 28 samples of Revit 2023 to 2027 is 1.005, and no file is above 1.05.
Next. Two timed runs of the 2023 samples under
--saved-meshesfind which of the two fixes raises the peak:v0.14.0against fix(saved-graphics): the pass frees an owner's graph with its batch, so the walls that embed a curtain wall stop raising the export's peak (#1429) #1441 alone: 43305037655;On your three fixtures your port matched this mixed picture: one fell from 6.8 to 1.8 GB, and two were unchanged. What we ship will lower the peak or leave it, file by file, not raise it on some files to lower it on others.
ci(release): a failed tag lookup fails the release instead of keeping…
ci(release): a failed tag lookup fails the release instead of keeping…
DrunkOnJava commentedon Nov 12, 2026
Row 3, read again: the office clause fails because the backport's pass is not what holds the offices' peak. The 2023
rac_basicrise is #1441's. Still no tag.The bisect. Two timed runs of
--saved-meshes:v0.14.0against fix(saved-graphics): the pass frees an owner's graph with its batch, so the walls that embed a curtain wall stop raising the export's peak (#1429) #1441 alone (43305037655): 2023rac_basic537 to 790 MiB (1.47), time 1.08.So #1441, the batch freeing, raises it, and #1691 adds nothing. Two variants of #1441 rule out its re-read of a freed owner. Without the re-read (43309303255), and with batches sized over symbol records only (43309312639), the file stays at 789 and 790 MiB. Two more variants are running now:
v0.14.0's batch planning and its owners still freed (43312088155);Where each file's peak sits.
probe_1075_memory_stages, set to the--saved-meshesscope, onv0.14.0(43309508151) and the branch (43309516582). It reads each stage's RSS peak from/proc/self/status:v0.14.0rme_basic2024rac_basic2023v0.14.0's, which leaves the whole export at 0.87 and 0.97.v0.14.0's.rac_basic. It is the one file where the pass grows: 348 to 601 MiB, all inside the saved-mesh stage, with the same output (340 of 394 bodies replaced, 620,916 triangles either way). That rise has to go before a tag, and the two variants above find which part of fix(saved-graphics): the pass frees an owner's graph with its batch, so the walls that embed a curtain wall stop raising the export's peak (#1429) #1441 causes it.chore(release): one command moves every version file, a hotfix's rele…
fix(research): the saved-mesh pass plans its batches as 0.14.0 did, s…
DrunkOnJava commentedon Nov 12, 2026
The 2023
rac_basicrise is fixed, and every row holds except the office clause. Before we tag, could you run the branch on your model?The cause. The rise came from how #1441 plans its batches, not from the freeing itself. Two variants of #1441, timed under
--saved-meshes:v0.14.0's batch plan, with owners still freed (43312088155): 2023rac_basicpeaks at 523 MiB. The offices land at 0.87 and 0.97, and 23 of 23 exports are equal.So the freeing gives the gain, and the plan gave the rise. Under #1441's plan, the owners that name no symbol get a batch of their own, and only batches of symbols size the next one.
The fix.
abbc6d9conhotfix/v0.14.1keepsv0.14.0's plan: those owners share the first batch, as they did in 0.14.0. It keeps #1441's freeing and #1691's streaming of the owners that name nothing. This corrects my first comment:native_saved_scene.rson the branch no longer equals979ec428's, because its batch plan is 0.14.0's.The rows, run again. The run measured
f6c4458fagainstv0.14.0. That commit is the branch's code without the version bump, which would otherwise change the version string in every IFC header.Default export unchanged. Holds (43315345839). 112 of 112
ifc.sha256and 93 of 93diagnostics.jsonequalv0.14.0's, and no scorer output moved.--saved-meshesexport unchanged. Holds (43315354501). 112 of 112 and 93 of 93.Peak,
--saved-meshes. No file's peak is above 1.00 ofv0.14.0's.v0.14.0rac_basic2023The office clause (0.80 or less) is not met, for the reason in my last comment: the export's own model holds those two peaks, and this release does not touch it. The release notes will say so.
Time,
--saved-meshes. Holds. The median over the 28 samples of Revit 2023 to 2027 is 1.01, and no file is above 1.06.What we'd like from you. The 6.8 GB to 1.8 GB you measured was your own port of #1691. 0.14.1 is not that code, since it keeps 0.14.0's batch plan, and nobody has run it on your model. Before we tag, could you run
abbc6d9con your 122 MiB model and post two things:You can build it the way you built your port. Or you can download the binaries from the branch's Release binaries run (downloading needs a GitHub login). That run covers Linux musl, macOS and Windows, with
SHA256SUMS.We'll hold the tag for your result. If you can't run it, say so, and we'll tag on our own evidence and say in the notes that 0.14.1 itself was not run on your model.
DrunkOnJava commentedon Nov 12, 2026
One addition to the above: we'll hold the tag until Monday, November 16. If we haven't heard by then, we'll tag 0.14.1 on our own evidence, and the notes will say that 0.14.1 itself was not run on your model. A report from you after that still counts: if 0.14.1 does worse than your port on your model, a 0.14.2 follows.
docs(changelog): 0.14.1's section states what the two re-measures fou…
fix(ci): bump_version.py reads every release workflow and local actio…
5 remaining items
docs(changelog): 0.14.1 is dated 2026-11-19, names 0.25.0 as the late…
test(saved-batches): the batched saved-graphics read and the one-shot…
ci: the i686 job's package install retries from Ubuntu's own archive …
docs(changelog): main carries the 0.14.1 section and the roadmap list…
DrunkOnJava commentedon Nov 19, 2026
@shifatrHtH, 0.14.1 is out: release page,
rvt = "=0.14.1",pip install rvt==0.14.1, orghcr.io/drunkonjava/rvt-rs:0.14.1. What went in from your #2081, and how the published files were checked, is in my comment there. In short, for anyone landing here: it is 0.14.0 with only the saved-mesh pass's memory changed, and the exports of the published binary and wheel on three reference models are 0.14.0's line for line, apart from the version they record and the time of the export.The one thing still open is yours: 0.14.1's peak memory on your 122 MiB model. It keeps 0.14.0's batch plan, so it is not the port you measured. I'm closing this as done. If 0.14.1 does worse there than your port, say so here and I'll reopen it, and a 0.14.2 follows.
docs: the user guide, README, CONTRIBUTING and ROADMAP say what later…
docs: the 1.0 criteria, export diagnostics, RELEASE, SECURITY, ifc-co…