Improve decoration cell lookup performance#5886
Conversation
|
Thanks Per, I tried the latest #5853 (3dbd370) this morning. I don't have the full search-addon Playwright harness polished yet, so I started with a small synthetic benchmark that isolates the renderer-side hot path: 100k single-line decorations, scan a 30x80 visible grid, medians of 7 runs after 2 warmups.
So yes, with the latest My read is: #5886 is still a tiny master-compatible stopgap for the current API; #5853 looks like the broader fix once that larger buffer/marker refactor is ready. I'm happy either way: keep this PR scoped as the small interim path, or close it if maintainers would rather focus review on #5853. |
|
Thanks for the PR! I looked at this earlier and it rubbed me the wrong way that there are essentially fast and slow modes, where a single multi-line decoration would make everything slow from them on. This was inspiration for #5902 which solves the problem in a more general way |
Summary
Refs #5176.
This speeds up decoration lookup for the common single-line decoration case. When no registered decoration spans multiple rows,
forEachDecorationAtCellnow asks the sorted decoration list for the current line instead of scanning every decoration for every cell.Multi-line decorations continue to use the existing full scan path so their behavior is unchanged.
Validation
npm run build && npm run esbuildnpm run test-unit -- out-esbuild/common/services/DecorationService.test.js out-esbuild/common/SortedList.test.jsnpm run lint-changesNotes
A local micro-benchmark with 10k single-line decorations over an 80x24 viewport for 20 iterations went from about 2479ms on the full-scan path to about 6.9ms with the line-keyed fast path.