Repository navigation
perf(research): a decoded graph's fields are the compact value from the decoder to its readers (#1694) - #1800
Merged
Merged
Conversation
…to serde_json::Value, and a probe that sizes it on real graphs (#1694) A decoded graph object's fields are serde_json::Values, and 75% to 87% of the saved-mesh pass's peak is those nodes: 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. graph_value::Fv holds the same content with an object's values in one slice and its names once for every object that has them. from_json and to_json are exact (number kinds, key order and all), with failure-first tests of the conversion, and nothing reads a graph through Fv yet. probe_1694_compact_graph decodes every native record of a file one record at a time, counts the live heap bytes of the decoded graph, of a clone of its objects' fields and of their conversion, and checks the round trip on every object. Whether the readers move onto Fv is decided by its rows on the issue.
…h a scratch keep-going check workflow
…'s Bool as Fv::Bool
…erde_json, Obj iterates and Fv tests is_i64
… probes, Fv::from_pairs builds an object from pairs
# Conflicts: # probes/examples/probe_1694_compact_graph.rs # src/research/graph_value.rs
…ld it reads, as before; only the top object holds the kept ones (#1694)
… so no public impl makes it reachable; a view's keys are listed without indexing (#1694)
…ough iter(); no impl for a boxed one, which made Obj reachable from the public API (#1694)
…_types, with the reason: rustc counts the IntoIterator impl on &Obj as public (#1694)
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 03:42
DrunkOnJava
added a commit
to puzzbobb/rvt-rs
that referenced
this pull request
Nov 12, 2026
…e report takes RE-445 Merging main brought DrunkOnJava#1800, which makes a decoded graph's fields rvt::research::graph_value::Fv: forge reads its format map through it. RE-439 is DrunkOnJava#1791's report on main, so this one is RE-445 (report, probe and every citation of the units reading).
DrunkOnJava
pushed a commit
that referenced
this pull request
Nov 12, 2026
…1797) ## Summary Read a zero `RuledSurf` profile pointer as its separately saved point, bounded to point/arc patches with a unit envelope and rectangular trim. Bodies containing these patches are admitted only when their source element record has `OST_DUCT_FITTING`. On the public Revit 2023 basic MEP sample this recovers **105 duct fittings**. The two sanitary terminals keep their record boxes and an explicit refusal. Output remains `IfcTriangulatedFaceSet`. ## Motivation One shared pointer rule recovers measured bodies without element-specific decoders. RE-443 records the public file, streams, record hashes, offsets, bytes and values. The body category restriction follows the review of `5a0f8d1f`: the terminals miss the strict native-reference threshold even with fine tessellation. ## Changes - Merge upstream `97397b9e`, preserving its project-unit and type-layer changes and both independent reconnaissance addenda. The comparisons below were rerun against that refreshed base. - Read `m_Point1`/`m_Point2` only for a zero profile pointer, including the limiting pole normal and collapsed rectangular trim side. Both-null profiles, missing/invalid points, unresolved nonzero pointers, other curve combinations, non-unit envelopes and other trims remain refused. - Keep one cell along the straight generator, the reviewed arc grid and all trim knots. This revision changes no tessellation rule or positive accuracy bound. - Gate body admission using the source `BuiltInCategory` from the cached production walk, independently of IFC class or fixture ids. Unknown/conflicting categories fail closed. Other complete bodies containing these patches retain their boxes with `collapsed ruled profile outside the measured duct fittings`; already-partial bodies retain their existing decoder refusal. - Move terminals 543319 and 593903 from positive targets to explicit box/refusal controls. Add a real-file control that changes all 105 fittings' IFC classes to proxies and both terminals' classes to duct fittings: the source categories still decide admission. - Update RE-443, the manifest, status, support notes, reconnaissance addendum and changelog to the narrower scope and measured costs. ## Screenshots or output samples Local exports against base `97397b9e`, with deterministic headers: | Export | Recovered fittings | Triangles in those fittings | IFC bytes: base → new head | |---|---:|---:|---:| | Basic MEP 2023 | 105 | 64,380 | 101,091,346 → 105,006,306 | | Basic MEP 2024 | 105 | 64,380 | 103,550,587 → 107,465,590 | | Snowdon HVAC 2024 | 32 | 5,856 | 65,514,494 → 65,858,488 | The MEP fittings average 613.143 triangles, maximum 636. HVAC averages 183, maximum 212. Compared with `5a0f8d1f`, exactly the two terminals return to boxes on each locally checked MEP save; all 105 fitting representations and all placements are unchanged. HVAC, architectural basic 2024 and the BIM4LCA concrete office IFCs are byte-identical to that head. Local native-reference figures from RE-443: | Native reference tessellation | Fittings | Maximum sampled two-way distance | Maximum volume difference | |---|---:|---:|---:| | Default, primary | 105 | 0.696493 mm | 0.178479% | | Fine, supplementary | 105 | 0.131137 mm | 0.019083% | **Default: 0/105 pass the strict 0.001 ft threshold; fine: 105/105 pass.** Fine does not replace the default verdict. The two terminals previously missed at 0.720662 mm with both settings and are now refused, not accepted under a looser bound. ## Reproduction and evidence availability [`research/collapsed-ruled.json`](https://github.com/BIM4GIB/rvt-rs/blob/abd1db62e4c5687cbdd7897ff27acd4e17198e04/research/collapsed-ruled.json) pins the public Autodesk RVT, seven source records, 105 positive targets, two refusal controls and reference hashes/bounds. The RVT is also pinned in `research/autodesk-sample-projects.tsv` for Measure. The public source suffices for the byte and category controls: ```sh cargo build --locked --profile ci --bin rvt-ifc cargo run --locked --profile ci -p rvt-probes --example probe_collapsed_ruled -- /path/to/rmebasicsampleproject.rvt ``` Native scoring additionally requires the local **not-shared** archive. Its redistribution terms are not established; there is no reference download URL. Its unchanged SHA-256 is `77322bed93a88f027f473cd71578fa27aaeabf9402eaab99a445a1a138d6f93a` (52,288 bytes). ```sh python3 -m pip install --require-hashes -r tools/ci/requirements-ifc.txt python3 tools/re/replay_collapsed_ruled.py --work target/collapsed-ruled \ --reference-zip /path/to/collapsed-ruled-native-v1.zip --fine ``` The archive still contains the original 107 references, but only the 105 fittings are positive geometry targets. Both terminals must retain boxes with the exact refusal. Native comparison cannot be reproduced from public downloads alone. Source/archive/member hashes are checked; a failed replay cannot leave an old success result. No Revit automation is included. ## Testing - All required local workspace gates pass: formatting, clippy, strict checking, rustdoc, all-target/all-feature build, doc tests, real-file/CLI/contracts, MCP checks, examples and existing pure helpers. No new unit tests are added. - Against `97397b9e`, the 12-project comparison changes only the intended 105 MEP representations. Eight other project IFCs are byte-identical; three change only the established 6, 9 and 15 refusal notes. - All six REV/ARC fixture IFCs remain byte-identical, including partial-arc refusals. Source hashes are unchanged. - The focused comparison covers MEP 2023/2024, HVAC 2024, architectural basic 2024 and the office; its results are above. - All 608 graph refusal controls, 105 fitting/2 terminal IFC-class override controls and both terminal body-refusal checks pass. Native replay passes the existing default/fine regression bounds for all 105 fittings. - The merged tree was checked against upstream `97397b9e` across the 12 projects, six families and three additional focused projects (21 distinct inputs). All five focused IFC exports are byte-identical to `070a1436`, and the full native replay reproduces its results exactly. Documentation and measurement-claim checks pass. These are local results. The maintainer's unfiltered Measure and supplemental run passed the registered criteria on **the previous head `5a0f8d1f`**, before this category restriction. A fresh unfiltered Measure is required for this merged head, against `97397b9e`. Measure has no native IFC oracle for these samples; the accuracy figures above remain local RE-443 measurements. ## Audit honesty and contribution hygiene No workflow, dependency, build-script or README change. No model or native geometry archive is redistributed by this revision. The contribution uses public RVT bytes, Revit's own IFC export and existing rvt-rs readers/scorers; it includes no proprietary orchestration, SDK source, decompiled internals or copied revit-ifc implementation. Code is licensable under Apache-2.0. ## Breaking changes None to the stable API. ## Related issues RE-443, RE-430, #1737 and #1800.
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
A decoded graph's fields are the compact value
Fv(#1793) from the decoder on:class_inandfield_asbuild it directly,GraphObject.fields,ObjectFields.fields,Parameters.fieldsandParameter.raw_valuehold it, and the readers read it through the names they used onserde_json::Value. An object keeps its values in one slice and shares the list of its field names with every object of its class, so a node costs 32 to 34 bytes where aValuecost 172 to 215. Nothing a reader reads changes: the exports must be byte-identical (row 1 below), and the peak memory of the saved-mesh pass falls with the nodes it is made of (rows 2 and 3).Motivation
#1694: 75% to 87% of the saved-mesh pass's peak is decoded graph nodes. #1793 priced the typed value on 14 files before any reader moved (0.157 to 0.185 of a clone's heap, 4,276,161 objects round-tripped with 0 mismatches). This is the move itself. The rows are on the issue before any run: #1694 (comment)
Changes
src/research/native_parameters.rs: aClassPlanholds two views of a class's fields, each its sorted field names (shared,Names) and a slot for each field: every field the chain reads (an inline object, and any object of a decode that is not projected) and the kept fields alone (the top object of a projected decode).class_inwrites a field's value into its slot, and the old "ambiguous native field key" error is raised at the same point (through afilledcheck only for views whose keys collide);field_asbuilds scalars, strings, arrays, guid bytes and the pointer (Fv::pointer_value) asFv. A first version gave an inline object of a projected decode the kept fields only, and the PR'sCorpus healthcaught it (RE1 Electrical and Plumbing wrote 21 of 23 and 135 of 136 family-instance ports); the two views are the fix.src/research/graph_value.rs: what the readers need beside research(graph): a compact value for a decoded graph's fields, exact to serde_json::Value, and a probe that sizes it on real graphs (#1694) #1793's conversions:get, indexing,pointer, theis_*andas_*tests, comparison with a bool, a string or a number,Display,Serialize(byte for byte the JSON of theValueit stands for),Fromimpls,Fv::objectandFv::from_pairs, a process-wide table of names, and iteration of an object as(&str, &Fv). Failure-first tests of each (pure, no file or clock). The four public types allowunnameable_typeswith the reason beside them: rustc counts theIntoIteratorimpl on&Objas public, so a build withoutunstable-researchreads them as reachable, though no stable item names one (with every top-level item crate-private the public API compiled without aprivate_interfacesorprivate_boundsfinding).src/read a decoded graph asFv: the 26 that tookGraphObject,ObjectGraph,decode_graphorObjectFields, and the modules that hold a field of one (native_document,native_index,native_json,native_es_catalog,native_element_parameters,mep,slabs,framing,rooms,family_revolutions,revit_property_sets).as_arrayis a slice andas_objectanObj, the two differences fromValue.Fv; one that builds JSON for its output keepsserde_json::Valueand takes a graph value asFv::to_json()at the edge, so what it prints is what it printed.probe_1694_compact_graphsets what the decoder builds against the JSON of the same fields.Testing
cargo check --workspace --all-targets --all-features,cargo clippy ... -D warnings,RUSTFLAGS="-D warnings -D unnameable_types" cargo check --lib --bins,RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --liband the module's lib tests, all clean on the head (a scratch workflow on a scratch branch, not on this one); the PR's fast CI is green on it,Corpus healthincluded.full / CI passedon the final head (the head measured below isb512ec42; the changelog fragment is the only commit after it).holdout=true:ifc.sha256of all 145 exports identical tomain's, the diagnostics of the 120 that write them identical, no line of the censuses different, the semantic check andsame-project gatespass (read on #1694).timing, three rounds, both builds on one runner): time 0.75 to 0.94 ofmain's on all 29 files (together 0.83), at most 1.03 asked.rac_basic0.72,rac_advanced0.66,rst_basic0.50, every other file at most 1.00) and missed on the three largest: Snowdon Towers Architectural 0.79, the BIM4LCA office as built 0.78 and at permit 0.76, against 0.70 (read). A measured negative, reported as one; the dhat run registered next names what is left.Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None to the stable API.
rvt::research(unstable-research) types that held aserde_json::Valueof a graph now hold anFv.Related issues
Refs #1694.