react-native-dom icon indicating copy to clipboard operation
react-native-dom copied to clipboard

Text measurement

Open NekR opened this issue 6 years ago • 1 comments

I know it's too early for speed optimizations, just wanted to point out some way of doing so for text measurement, because it's what runs frame rate in the app right now (it forces browser layout).

So the more optimized way for main thread might measuring with <canvas>'s 2d context's measureText() API. Which measure itself most likely won't be any faster, it won't be causing any forced layout issues in the DOM.

For the off-thread measurement, OffscreenCanvas probably can be used, once it's implemented and supports 2d context rendering.

Just wanted to file this issue so it could be tracked by others or additional thoughts added.

Great work! 🎉

NekR avatar May 18 '18 09:05 NekR

Another option while waiting for OffscreenCanvas is to use FreeType compiled to wasm like some other web apps do.

kripken avatar May 19 '18 23:05 kripken