Repository navigation
Conversation
Share one parse across IFC/Scene/JSON outputs, trim retained native state, parallelize full-JSON element serialization, and remove hot-path allocations in the wide-schema walk, element construction, and IFC shell/quantity passes. Outputs stay byte-identical; adds a benchmark harness and regression tests.
This branch has not been deployed
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.
What this changes
Reader, post-processing, and exporter hot paths, without changing export bytes:
src/RvtIO/RvtFileReader.cs,src/RvtIO.Cli/ExportCommand.cs,src/RvtIO/Internal/JsonReadFacts.cs(new): oneRead()per CLI run feeds IFC, Scene, compact JSON, and full JSON. JSON consumers get a slimmedJsonReadFactsview (validated-name maps plus only the native stores compact JSON needs) instead of the fullParsingState; the quantity pass keeps the live state only when required. Full JSON no longer triggers a second file read. String scanning now overlaps background geometry decoding against a snapshotted ID set.src/RvtIO/Parsing/WideElementRecords.cs: framed partition streams are indexed from their known record boundaries instead of concatenating the whole section first; unframed streams keep the old path. Adds a regression test that splits a record across segments plus an allocation guard.src/RvtIO/Parsing/WideBlockWalker.cs,WideNativeParams.cs: cache schema field chains and name lookups; resolve capture keys once per field; single-pass best-rank name resolution with the same priority as before.src/RvtIO/Parsing/ElementBuilder.cs,Model/Parameter.cs,Model/Geometry.cs: shared reader parameter metadata, boxed-value reuse, fewer per-parameter/per-face temporaries.src/RvtIO/RvtDocument.cs:ForSceneExportshares read-only parameters with the model instead of cloning every value; mutating repairs still copy. Covered by a scene-isolation test.src/RvtIO/Ifc/IfcExporter*.cs: column quantities defer full shell measurement to the fallback path; stair-run counting uses a per-export index instead of scanning all elements; contracted-shell preparation avoids repeated full-face materialization and duplicate orientation work.src/RvtIO.Cli/FullJsonOutput.cs(new): element batches serialize in parallel with byte-identical output, with a streaming fallback for oversized batches. Wired into--full-jsononly.src/RvtIO/Model/ParameterListConverter.cs: pre-encoded property names and direct int/string writes for the CLI dump; the parameterized constructor is internal and the default path is unchanged (pinned byCompactLegacyJsonIdentityTestsin both modes).tools/benchmark-export.py(new) +CONTRIBUTING.md: repeatable A/B harness — alternates build order, fixes the IFC timestamp, SHA-256-checks all five outputs per run, reports medians and peak working set, optional--min-speedupgate.Validation
dotnet build RvtIO.slnx -c Release: success, 0 errors (315 warnings, same pre-existing count as the base build).dotnet test tests/RvtIO.Tests/RvtIO.Tests.csproj -c Release --no-build: net8.0 12054 passed / 449 skipped / 0 failed; net10.0 12058 passed / 449 skipped / 0 failed.dotnet build src/RvtIO.Scene/RvtIO.Scene.csproj -c Release -p:BuildNativeCoreOnly=true --artifacts-path ./artifacts/native-core-check: success.FullJsonOutputTests(parallel + oversized batches byte-match the streaming serializer, indented and compact), framed-index split-record test, name-ranking tests, scene-export isolation test.Measured effect (single Windows machine, Release, .NET 10, medians)
Small models: 2023 batch 8.90s -> 8.57s, peak WS 1346 -> 1289 MiB, allocated bytes -13%; 2023 full JSON 3.06s -> 2.79s, peak 600 -> 486 MiB, allocated -26%; 2025 batch 16.33s -> 16.28s, peak 2672 -> 2598 MiB; 2025 full JSON 3.30s -> 3.02s, peak 694 -> 519 MiB, allocated -35%.
888 MiB model, same four-format batch: one paired comparison 231.7s -> 176.9s (1.31x); a later 3-run A/B gave medians 205.2s -> 164.1s (1.25x), peak 35.4 -> 29.8 GiB. Baseline runs varied widely (182-309s), so treat single-digit deltas with care. Four separate single-format runs of the candidate total 364.1s vs 164.1s batched (2.2x batching benefit, not a per-build speedup).
The 2x target for the same batch export is not met by this change (1.25x median). Scene time dropped substantially in the paired run (44.9s -> 15.8s); read remains the dominant cost (67-78s of the total).