Skip to content

perf: optimize displacement export falloff — SoA layout, flat grid, merged passes#34

Open
Avatarsia wants to merge 3 commits intoCNCKitchen:mainfrom
Avatarsia:perf/displacement-falloff-optimize
Open

perf: optimize displacement export falloff — SoA layout, flat grid, merged passes#34
Avatarsia wants to merge 3 commits intoCNCKitchen:mainfrom
Avatarsia:perf/displacement-falloff-optimize

Conversation

@Avatarsia
Copy link
Copy Markdown
Contributor

Summary

  • Integrate position lookup into existing dedup pass, eliminating a redundant iteration over all vertices
  • Replace boundaryPositions array-of-arrays ([[x,y,z], ...]) with flat SoA layout (bpX, bpY, bpZ as Float64Array)
  • Grid cells store boundary-point indices instead of [x,y,z] sub-arrays
  • Replace bGrid = new Map() with bGrid = new Array(gridSize) for direct index access in the nearest-neighbor hot loop

Impact (100k triangles, ~5k boundary vertices): Eliminates ~5,000 mini-array allocations, replaces ~675,000 Map.get() calls with direct array indexing in the nearest-neighbor search, saves one full pass over 300k vertices.

Test plan

  • node --check js/displacement.js passes
  • Playwright: app loads without JS errors
  • No console errors across all tests

🤖 Generated with Claude Code

Avatarsia and others added 3 commits April 7, 2026 15:51
…iteration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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