mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 02:12:00 +03:00
Refactors renderDocList to use a DocumentFragment for batching element insertions, preventing multiple reflows and repaints in the loop. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
3 lines
424 B
Markdown
3 lines
424 B
Markdown
## 2024-07-08 - Use DocumentFragment to batch DOM inserts
|
|
**Learning:** Batching DOM insertions using DocumentFragment reduces repaints and layout recalculations. While the exact performance impact relies on environment details (e.g. vitest+jsdom drops time by ~25%), it's a standard and safe optimization for large loops.
|
|
**Action:** Apply DocumentFragment before loops that append many elements to a live DOM container.
|