Repository navigation
perf(ifc): rvt-ifc writes the IFC as it builds it, after releasing the file handle (#1075) - #1291
Merged
Merged
Conversation
DrunkOnJava
marked this pull request as ready for review
November 3, 2026 18:58
DrunkOnJava
enabled auto-merge (squash)
November 3, 2026 18:58
Owner
Author
|
Automated Claude Code review (the maintainer's review agent; it read the code and runs 41671835683 and 41671841772): no blocking items. Fixed anyway in ea91a5c: rvt-ifc streams to a file beside the output and renames it only when whole, so a failed export leaves no truncated model.ifc; the handle is released on both paths; and write_step_to takes its writer by value and counts in u64. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For #1075:
rvt-ifcwrites the IFC as it builds it. The STEP text was built whole in memory and then written. Now it is handed to the file every MiB, after the file handle, and the partitions it keeps inflated, are released. The bytes are the same.rvt::ifc::step_writer::write_step_tostreams to any writer.Motivation
#1075's reporter sees a 10.3 GB peak on a 438 MB model, and a 1.13 GB model running out of memory at 16 GB. The stage probe (Measure 41659406909) splits the office's memory:
The reporter has been asked to run the probe on their model; this change is the part that needs no such evidence.
Changes
src/ifc/step_writer.rs:Stringbuffer, and with a sink it hands the buffer on whenever it passes 1 MiB;write_step_to<W: io::Write>(model, options, out: W) -> io::Result<u64>; pass&mut writerto keep the writer;write_stepandwrite_step_with_optionsare unchanged, so the Python and wasm bindings keep the text API.src/bin/rvt_ifc.rs:RevitFileis dropped before the text is written, on both paths;--observation, the text is streamed to<output>.partialand renamed to the output when whole, and the partial file is removed on an error, so a failed or killed export leaves no truncated IFC under the output's name;--observation, the witness reads the text back, so it is still built whole.probes/examples/probe_1075_memory_stages.rs: the stage probe, with a laststep_streamstage.changelog.d/changed/1075-stream-step.md.Testing
main(-f nordic=true -f r2025=true -f samples=true -f holdout=true). All 109 exports hash the same;ifc.sha256leaves out the timestampedFILE_NAMEandIfcOwnerHistory. On the 92 whose log is kept (held-out logs are scrubbed),rvt-ifcreports the same byte counts. After review and a merge ofmain, 41691823738 (291fbb3 againstmain): 92 of 92 exports byte-identical, and no.partialfile left in any model's folder.rvt-ifc. At building permit the run's peak was the STEP text (1.68 GiB); it is now the saved-graphics pass (1.59 GiB). As built, the saved-graphics pass already set the peak (1.65 GiB), so it does not change.Not changed
Legal and contribution hygiene
Breaking changes
None. One public function is added.