Share computed point keys across preview, editing and stats (#11) - #12
Merged
Conversation
Compute point string keys once per layout (App-level keyPoints) and thread the KeyedPoint[] into the preview, useHoleEditing and computeTubeStats, instead of each recomputing createPointKey over every point. On dense layouts that removes ~2/3 of the per-layout key work (a full pass was ~9ms at 52k points). - add shared KeyedPoint type + keyPoints() helper in core - PreviewCanvas takes keyedPoints (drops its internal key memo) - useHoleEditing builds pointByKey from existing keys - computeTubeStats consumes keyed points (tests updated) No behaviour change; verified in-browser (render, select, stats, tie-rod edit). Closes #11. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
Compute tube-point string keys once per layout and share the result, instead of recomputing
createPointKeyover every point in three separate modules.Change
KeyedPointtype +keyPoints()helper in core.AppbuildskeyedTubesonce (memoised ontubeCoords) and threads it into:PreviewCanvas— now takeskeyedPointsand drops its own key memouseHoleEditing— buildspointByKeyfrom the existing keys (no key pass)computeTubeStats— consumes keyed points directlyImpact
A single key pass was ~9 ms at 52k points and previously ran ~3× per layout change (~27 ms on the main thread). This collapses it to one pass. Negligible for typical layouts (sub-ms), meaningful only near the point cap — the honest remaining hot spot from the earlier render investigation.
Verification
pnpm typecheck✅ ·pnpm test(58,computeTubeStatstests updated for keyed input) ✅ ·pnpm build✅🤖 Generated with Claude Code