Skip to content

perf(mep): find MEP system members and pipe type names in one pass per stream (B70) - #661

Merged
DrunkOnJava merged 2 commits into
mainfrom
perf/b70-one-pass
Oct 4, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
perf/b70-one-pass

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

B70: rvt-ifc took 33.5 minutes on Autodesk's 2024 MEP basic sample (rvt-info 0.02 s), so Measure timed out on the MEP samples (B68). Timing checkpoints on a scratch branch (run 37216027753) put 1,007 s of each walk in attach_mep_systems (a search per system id, then a backward search of up to 200,000 bytes per occurrence) and 19 to 24 s in attach_pipe_type_names (a search per referenced id). Both are now one pass per stream; partition_room_parameters::data_objects lists a buffer's verified data objects once.

  • Speed: each walk 9.8 s instead of 1,037 s (run 37219167645); rvt-ifc walks twice (B71), about 19 s in all.
  • Same output: Measure against main (run 37219141584) gives byte-identical IFC for all six models, the three RE1 MEP models included.

Note

Medium Risk
Logic changes how partition bytes are traversed for MEP membership and type names; behavior is validated as byte-identical IFC on measured models, but false positives in id-range scans could still mis-associate members or names on unseen files.

Overview
B70 replaces repeated partition-buffer searches with one pass per stream for two hot MEP paths, cutting multi-minute walks to ~10s each while keeping byte-identical IFC output.

Adds partition_room_parameters::data_objects, which walks a buffer once and yields every verified RE-153 data object (cheap structural checks before Adler-32). scan_mep_systems now uses it to attach system members: for each element in elements, it scans that object’s payload for u32 words in the known system id range instead of memmem per system id plus enclosing_data_object backward searches.

find_mep_curve_type_names similarly scans the buffer linearly for the pipe/duct type layout (ElementId + repeat at +56), filtering by the min/max of wanted, instead of one memchr search per id.

Reviewed by Cursor Bugbot for commit 4e7ebbc. Configure here.

…r stream (B70)

On Autodesk's 2024 MEP basic sample rvt-ifc took 33.5 minutes and rvt-info
0.02 s, so Measure timed out on the MEP samples (B68). Timing checkpoints
(scratch run 37216027753, rmebasicsampleproject 2024) put 1,007 s of each
walk's schema pass in attach_mep_systems and 24 s in attach_pipe_type_names,
and rvt-ifc walks twice (export, then diagnostics).

- attach_mep_systems searched every stream once per system for the
  system's id and, at each occurrence, walked back up to 200,000 bytes
  trying a data object header at every byte (enclosing_data_object). New
  partition_room_parameters::data_objects lists a buffer's verified data
  objects in one pass, trying the Adler-32 only where a header's zero word
  and both sizes agree; membership now scans the payloads of the objects of
  the elements asked about for system ids.
- find_mep_curve_type_names searched every stream once per id a pipe's
  record references. It now makes one pass, asking each offset first
  whether the u64 there repeats MEP_CURVE_TYPE_ID_REPEAT bytes on.

With both (scratch run 37218556707, a first version that also changed the
untimed pipe diameter scan, since dropped) each walk took 30 s, 4.4 s of it
in attach_mep_systems; the type names' pass is in this commit only.
@DrunkOnJava
DrunkOnJava merged commit 12e2ec9 into main Oct 4, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/b70-one-pass branch October 4, 2026 17:28
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
… Measure (B68) (#640)

B68: pins Autodesk's MEP sample projects (rme_basic and rme_advanced,
2024 to 2027) in research/autodesk-sample-projects.tsv for Measure's
samples option. With B70 (#661) and B71 (#664), Measure with every
sample, the eight MEP projects included, completes in 7 minutes (run
37221135938); rvt-ifc and rvt-info exit 0 on all eight.
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