Skip to content

Flatten and parse STEP files in parallel (ENG-3819) - #27

Merged
akhilles merged 2 commits into
masterfrom
akhil/eng-3819-foxtrot-step-parsing-is-single-threaded-and-slow-on-large
Oct 10, 2026
Merged

akhilles merged 2 commits into
masterfrom
akhil/eng-3819-foxtrot-step-parsing-is-single-threaded-and-slow-on-large

Conversation

@akhilles

@akhilles akhilles commented Oct 10, 2026 •

Copy link
Copy Markdown

This change flattens and parses STEP files in chunks on the rayon pool when triangulate/parallel is on, removes per-record overhead in the parser, and shrinks each Entity table slot from 128 to 64 bytes (ENG-3819). StepFile::parse now takes &str and strip_flatten returns String; callers that pass the flattened output compile without change. On the 154 MB CM4 model, flatten and parse take 0.19 s instead of 1.9 s, and all 948 corpus models give the same entities and meshes as master.

strip_flatten and StepFile::parse split their input into chunks and,
with the new optional step/rayon feature (enabled by
triangulate/parallel), process the chunks on the rayon pool. Results
are applied in file order, so the output, duplicate-ID handling and
the first reported error match the sequential parse. Without the
feature (wasm), each input is one chunk.

Parsing also avoids per-record overhead: memchr finds entity names,
references parse without nom combinators, UTF-8 is checked once per
chunk, reference checks use a bitset, and complex entities use a small
vector instead of hash maps. A complex entity that omits a supertype
is now an invalid record instead of a panic.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Left a non-blocking comment. This is a functional STEP flatten/parse change, not a small fixup, so it was not approved. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

StepFile::parse now takes &str and strip_flatten returns String, since
flattening already emits only ASCII. This removes the UTF-8 checks and
fallbacks from parsing.

Records are parsed in chunks and applied in file order, as in the
sequential loop. This removes the ID-to-record table, the duplicate-ID
and first-error bookkeeping, and the error rescan, with the same result.

The generator now boxes entities by estimated payload size instead of
attribute count. The 110 records with payloads over 56 bytes are boxed,
so every Entity slot is 64 bytes instead of 128, and a compile-time
assertion keeps it so.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a non-blocking comment. This is a functional STEP flatten/parse change, not a small fixup, so it was not approved. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@akhilles
akhilles merged commit fefbc21 into master Oct 10, 2026
3 checks passed
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