GitHub - leeoniya/uWrap: A 10x faster and more accurate text wrapping util in < 2KB (min)
⏎ μWrap
A 10x faster and more accurate text wrapping util in < 2KB (min) (MIT Licensed)
Introduction
uWrap exists to efficiently predict varying row heights for list and grid virtualization, a technique for UI performance optimization when rendering large, scrollable datasets.
Doing this both quickly and accurately turns out to be a non-trivial task since Canvas2D provides no API for text wrapping, and measureText() is quite expensive;
measuring via DOM is also a non-starter due to poor performa...
Read more at github.com