Skip to content

perf(partitions): a partition stream's data objects are scanned once per file (B80) - #691

Merged
DrunkOnJava merged 1 commit into
mainfrom
perf/b80-object-cache
Oct 4, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
perf/b80-object-cache

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

The original symbols (RE-167), railing types (B45) and MEP systems (RE-162) each scanned every partition stream for its data objects (RE-153). RevitFile::partition_data_objects keeps each stream's scan, as it already keeps inflated streams, and the three read it. A data object is an offset and three words, so the cache is small.

Measure run 37242962338 compares this commit against main with #690, both carrying the same scratch timing checkpoints. The IFC is byte-identical on all six models and 36 samples. Each step is timed inside its own export, so runner speed cancels when a step is compared with untouched steps of the same process. On the 2025 rme_advanced sample the head runner ran untouched steps at about x0.75; the MEP systems step went from 4.58 s to 0.06 s:

step, 2025 rme_advanced main this PR
original symbols (fills the cache) 4.38 s 3.10 s
MEP systems (RE-162) 4.58 s 0.06 s
curve fields (RE-134, untouched) 7.74 s 5.21 s
fitting sizes (RE-165, untouched) 6.82 s 4.53 s

An earlier pair of runners (run 37241953046) showed RE-134 and RE-165 at x1.5 with this change. That pair spread untouched steps from x1.00 to x1.58, and this run puts both with the runner, so it was runner noise. RE-134's and RE-165's own per-id scans move onto this cache in the next PR.


Note

Low Risk
Behavior-preserving refactor: same scan logic, shared via cache on RevitFile; only performance and call-site plumbing change.

Overview
Adds RevitFile::partition_data_objects, which scans each partition stream’s inflated bytes for RE-153 data objects once and stores the result in a per-stream memo (B80), mirroring the existing inflated-stream cache.

MEP system member linking and schema MVP paths (railing type names and original-symbol resolution) now iterate the cached (offset, DataObject) list instead of calling partition_room_parameters::data_objects on every pass over the same stream.

The first consumer that walks all partitions still pays the scan cost; later steps reuse the cache, which is why MEP systems timing drops sharply on large models while export output stays unchanged.

Reviewed by Cursor Bugbot for commit f69632b. Configure here.

…per file (B80)

The original symbols (RE-167), railing types (B45) and MEP systems
(RE-162) each scanned every partition for its data objects (RE-153).
RevitFile::partition_data_objects keeps each stream's scan, as it keeps
inflated streams, and the three read it.
@DrunkOnJava
DrunkOnJava merged commit ab6e014 into main Oct 4, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the perf/b80-object-cache branch October 4, 2026 23:29
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
… data objects once (B80) (#693)

`scan_pipe_diameters` (RE-157, in RE-134's step) searched every
partition stream once per pipe id, and `scan_fitting_nominal_diameters`
(RE-165) once per fitting id. That is the per-id pattern B70 removed
from the MEP systems. Both now walk the stream's cached data objects
(`RevitFile::partition_data_objects`, #691) and keep the objects whose
ElementId they want. A value still stands only where every copy agrees,
which does not depend on the order the copies are met in.

Measure run 37243310000 compares this commit against `main` with #691,
both carrying the same scratch timing checkpoints. The IFC is
byte-identical on all six models and 36 samples.

| 2025 rme_advanced | main | this PR |
|---|---:|---:|
| curve fields (RE-134) | 7.82 s | 1.00 s |
| fitting sizes (RE-165) | 6.89 s | 0.01 s |
| original symbols (untouched) | 4.27 s | 4.33 s |
| whole export | 28.1 s | 16.2 s |

Across the 36 samples and six models, export time goes from 201.2 s to
161.6 s. Inside RE-134, `scan_curve_fields` is 0.73 s of what is left.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Behavior-preserving performance refactor on partition parsing; export
output is reported byte-identical on measured samples.
> 
> **Overview**
> **`scan_pipe_diameters`** and **`scan_fitting_nominal_diameters`** no
longer run a `memmem` search over inflated partition bytes for every
target ElementId. Each partition stream is loaded once with
**`RevitFile::partition_data_objects`** (alongside the inflated buffer),
and both scanners walk that object list and keep entries whose id is in
the requested set.
> 
> Pipe scanning still filters **`RbsPipeCurve`** objects and reads
inner/outer diameters at **`PIPE_INNER_DIAMETER_OFFSET`**; fitting
scanning still parses nominal size from each object's payload.
**Multi-copy agreement** is unchanged—conflicting values still drop the
element from the result map.
> 
> Fitting sizes drops the **`verified_data_object`** import because
object boundaries come from the cached index instead of rediscovering
headers in the raw buffer.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a122ecb. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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