4 ms·
For my own realtime browser based ASCII projects I update the DOM “manually”: the biggest bottleneck is frequent -horizontal- changes in color as each character
by agys 5y ago
For my own realtime browser based ASCII projects I update the DOM “manually”: the biggest bottleneck is frequent -horizontal- changes in color as each character with a new color needs to be wrapped in its own <span> element. After all you can’t avoid a DOM repaint.
After several benchmarks I realized that the fastest way to update the entire window is to compose a string and assign it to each line/line-element via innerHTML. I usually get 60fps with 5-8k chars in fullscreen (browser text rendering has become really fast).
- stjohnswarts 5y agoMaybe you could benchmark it against this. It would make an interest HN followup post.
- sickill 5y agoIt's not the rendering / DOM part that got 50x faster though, so that would be apples to oranges.