Commit 61e87fb
committed
perf(engine): pool the canvas-write u8 scratch buffer
Float renders write the working f32 buffer onto the canvas through a
`new Uint8ClampedArray(4 * w * h)` allocation each tick. For a 4 MP
image that's a 16 MB ephemeral allocation per slider drag - more GC
churn than I'd like for the interactive path.
Keep the scratch on the Imgstry instance and reuse it; only re-allocate
when the dimensions change.1 parent 9f5aaa9 commit 61e87fb
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| |||
369 | 374 | | |
370 | 375 | | |
371 | 376 | | |
372 | | - | |
373 | | - | |
374 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
| |||
0 commit comments