Roadmap 0.10, Performance roadmap — wave 3

PERF.28 CadCraft: the redraw cache is one Path2D per color for the whole drawing, rebuilt from every entity on every change, with no culling or level of detail

  • Fix
  • Planned
  • CadCraft

Measured in /use 0.8.2 (software GL, so frame time is main-thread cost) with 10k / 100k / 1M entities (1M = the 100k drawing multiplied in the page): view.js:646-721 builds one Path2D per color for the whole space and any edit, undo, redo, layer flag or REGEN rebuilds it from scratch: 0.8 s at 100k, 33 s at 1M (move all = 35 s redraw, undo 29 s, one layer off 34 s; undo itself is a delta and takes 68 ms, the redraw is the cost). Path2D.closePath() on a multi-million-segment path costs in proportion to the path: 18 % at 100k, 45 % (73 s) at 1M. The whole drawing is stroked each frame and drawTexts loops over every text: one redraw 25 ms at extents and 58 ms zoomed in at 1M. Change: per-chunk or per-tile Path2D keyed by entity, rebuilt only for the entities an operation touched, first build sliced across frames; a grid or R-tree of bounds so only visible chunks are stroked, sub-pixel chunks skipped, an offscreen bitmap for pure pans. Also a Discord member.load draws inside the load event (view.js:81 to fit() to ensureCache(): 33 of the 37 s load at 1M). Targets for the 100k drawing: open under 3 s, redraw p95 under 33 ms.

Add a comment

Community comments

No comments yet

Add detail as we go: how you would use it, files or steps that show the problem, what other programs do. The team reads every comment.

Sign in or create a free account to add a comment.