But with modern hardware, running the dynamic programming solution to this optimization problem takes a trivial amount of cycles* compared to rendering your typical React webapp.
* for most webpages. Of course you can come up with giant ebooks or other lengthy content for which this will be more challenging.