Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What you're missing is that each segment (typically a word) only needs to be measured once, in the setup phase. The canvas gets thrown away after that, and subsequent layout passes all reuse the cached measurements.

If you only perform layout once, it doesn't save any work. If you need to reflow many times, it saves a lot.



Are you sure the browser doesn't similarly cache it's own layout calculations?


I'm sure the browser does do that, and plenty of other optimisations too!

This thing isn't trying to do standard text layout faster than the browser, it's trying to enable more exotic/dynamic/custom layouts while keeping reasonable performance. Take a look at the demos linked in the repo's readme; those are things which the browser's layout engine can't do on its own.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: