In src/simplnx/Utilities/SegmentFeatures.cpp::execute(), after each feature finishes bursting, the driver runs voxelsList.assign(size + 1, -1). At that point size == 0 (the inner while(size > 0) loop guarantees it), so the vector's size shrinks to 1 while capacity is retained. The first accepted neighbor of every subsequent multi-cell feature then trips the growth guard (size >= voxelsList.size()), triggering a resize(size + 100000) plus an explicit loop writing 100k -1 sentinels — roughly 1.6 MB of memory writes per feature that do no useful work. The -1 sentinel values are never read anywhere (only indices below size, all previously written, are consumed).
At high feature counts (e.g. 1M features on a large EBSD volume) this is on the order of terabytes of wasted write traffic in the shared driver, affecting ScalarSegmentFeatures, EBSDSegmentFeatures, and CAxisSegmentFeatures alike.
Suggested cleanup:
- Drop the
assign(size + 1, -1) entirely (size = 0 is already reset at the top of each burst) and keep the vector's size stable across features.
- Drop both
-1 sentinel fill loops (initial construction and the growth path); the sentinels are write-only.
The write-before-grow indexing invariant (size < voxelsList.size() at every voxelsList[size] write) holds independently of the sentinel values, so this is a pure performance cleanup with no behavior change.
In
src/simplnx/Utilities/SegmentFeatures.cpp::execute(), after each feature finishes bursting, the driver runsvoxelsList.assign(size + 1, -1). At that pointsize == 0(the innerwhile(size > 0)loop guarantees it), so the vector's size shrinks to 1 while capacity is retained. The first accepted neighbor of every subsequent multi-cell feature then trips the growth guard (size >= voxelsList.size()), triggering aresize(size + 100000)plus an explicit loop writing 100k-1sentinels — roughly 1.6 MB of memory writes per feature that do no useful work. The-1sentinel values are never read anywhere (only indices belowsize, all previously written, are consumed).At high feature counts (e.g. 1M features on a large EBSD volume) this is on the order of terabytes of wasted write traffic in the shared driver, affecting
ScalarSegmentFeatures,EBSDSegmentFeatures, andCAxisSegmentFeaturesalike.Suggested cleanup:
assign(size + 1, -1)entirely (size = 0is already reset at the top of each burst) and keep the vector's size stable across features.-1sentinel fill loops (initial construction and the growth path); the sentinels are write-only.The write-before-grow indexing invariant (
size < voxelsList.size()at everyvoxelsList[size]write) holds independently of the sentinel values, so this is a pure performance cleanup with no behavior change.