Texture Tab: Laggy bei vielen Collisions #220

Closed
opened 2026-09-23 14:03:13 +02:00 by admin · 1 comment

Wenn ich bei den Texture Tab viele Collisions habe, dann ruckelt sehr stark. Am stärksten bemerkbar beim Mittelklick-Dragging, aber auch beim generellen Bearbeiten

Wenn ich bei den Texture Tab viele Collisions habe, dann ruckelt sehr stark. Am stärksten bemerkbar beim Mittelklick-Dragging, aber auch beim generellen Bearbeiten
admin added this to the Development project 2026-09-23 14:03:13 +02:00
admin moved this to Next in Development on 2026-09-23 14:03:17 +02:00
Owner

Fixed in fd6af84.

Cause (CPU profile over a pan, 768x576 texture in a 16 px grid = 1728 frames with one outline each):

  • Half of the time went into convexPieces: every redraw split every outline into convex pieces only to pick green or red.
  • Every pointer move during a pan rebuilt and re-tessellated the whole overlay geometry.

Fix (TextureCanvas):

  • Two layers. sheet holds all frames except the selected one and is rebuilt only when zoom, selection or one of those frames changes. overlay holds the selected frame, its handles and the rubber band.
  • Both layers are drawn without the pan; a pan only moves the container and places the names again (new hook SheetCanvas.panned(), defaults to redraw(), so Pixel Art and Vector Art are unchanged).
  • Outline validity is remembered per outline via polygonProblem (same result). Works because the model replaces outline lists instead of editing them in place.

Measured (1728 frames, 120 moves, main thread per move, before/after in the same browser):

Gesture before after
Middle-click pan 76.9 ms 4.7 ms (4.4 without frames)
Dragging a frame 51.7 ms 10.1 ms
Wheel zoom 52.2 ms 30.9 ms
Selecting another frame 67.6 ms 41.0 ms

Wheel zoom and selection still rebuild sheet once on purpose, so a single hitch per notch or click remains on very large sheets. If that bothers you, it would be a separate issue.

Tests:

  • ./check.sh: 148 files, 2214 tests, exit 0.
  • e2e 1-16,37,39-43: ALL PASSED, 641 checks.
  • 3 new checks in 42c-ii via __gm.texture.drawInfo(): a corner drag does not rebuild the other frames, an undo on an unselected frame reaches the picture, a pan moves outlines and names by exactly 40/25 px without a rebuild.
  • Counter-checks each fail at their check (the selected-frame-in-key one alone with 9 rebuilds during an 8-step drag).
  • Check total 1333 -> 1336 (computed, CI not awaited).

Wiki: Architecture and Development updated (8757318).

Fixed in fd6af84. **Cause** (CPU profile over a pan, 768x576 texture in a 16 px grid = 1728 frames with one outline each): - Half of the time went into `convexPieces`: every redraw split every outline into convex pieces only to pick green or red. - Every pointer move during a pan rebuilt and re-tessellated the whole overlay geometry. **Fix** (`TextureCanvas`): - Two layers. `sheet` holds all frames except the selected one and is rebuilt only when zoom, selection or one of those frames changes. `overlay` holds the selected frame, its handles and the rubber band. - Both layers are drawn without the pan; a pan only moves the container and places the names again (new hook `SheetCanvas.panned()`, defaults to `redraw()`, so Pixel Art and Vector Art are unchanged). - Outline validity is remembered per outline via `polygonProblem` (same result). Works because the model replaces outline lists instead of editing them in place. **Measured** (1728 frames, 120 moves, main thread per move, before/after in the same browser): | Gesture | before | after | |---|---|---| | Middle-click pan | 76.9 ms | **4.7 ms** (4.4 without frames) | | Dragging a frame | 51.7 ms | **10.1 ms** | | Wheel zoom | 52.2 ms | 30.9 ms | | Selecting another frame | 67.6 ms | 41.0 ms | Wheel zoom and selection still rebuild `sheet` once on purpose, so a single hitch per notch or click remains on very large sheets. If that bothers you, it would be a separate issue. **Tests:** - `./check.sh`: 148 files, 2214 tests, exit 0. - e2e 1-16,37,39-43: ALL PASSED, 641 checks. - 3 new checks in 42c-ii via `__gm.texture.drawInfo()`: a corner drag does not rebuild the other frames, an undo on an unselected frame reaches the picture, a pan moves outlines and names by exactly 40/25 px without a rebuild. - Counter-checks each fail at their check (the selected-frame-in-key one alone with 9 rebuilds during an 8-step drag). - Check total 1333 -> 1336 (computed, CI not awaited). Wiki: *Architecture* and *Development* updated (8757318).
admin moved this to Done in Development on 2026-09-23 15:58:00 +02:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#220