Files
soroban-abacus-flashcards/apps/web
Thomas Hallock 348ce8f314 perf: cache polygon conversions to fix performance regression
CRITICAL PERFORMANCE FIX: Converting SVG paths to Polygons on every mouse
move was causing severe lag. Cache the polygons per region ID.

Problem:
- pathToPolygon() samples 50 points using getTotalLength() + getPointAtLength()
- This was being called for EVERY region on EVERY mouse move
- For world map with ~200 regions, this was 200 expensive conversions per frame
- Completely unusable performance

Solution:
- Cache Polygon objects in a Map<regionId, Polygon>
- Only compute polygon once per region, reuse on subsequent detections
- Clear cache when map data changes (continent/map selection)

Performance improvement:
- Before: ~200 polygon conversions per mouse move
- After: ~200 polygon conversions total (one-time cost), 0 per mouse move
- Detection now runs at full frame rate

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 07:08:42 -06:00
..
2025-11-11 11:44:40 -06:00
2025-11-11 11:44:40 -06:00

Test deployment - Mon Nov 3 16:31:57 CST 2025