3 ms·
> `renderToString` is taking 500ms What baffles me is that this is a long time. In that time, you've got about a billion CPU instruction executions. If you inc
by pjc50 9y ago
> `renderToString` is taking 500ms
What baffles me is that this is a long time. In that time, you've got about a billion CPU instruction executions. If you include GPUs, they can render multiple frames of complex scenes to million+ pixel buffers in that time. And people are having trouble rendering a string?
- tetha 9y agoHm, I'd guess, it's latency to backend servers. Cores are plenty fast for just about every language. If you have a good network between systems, each request of any form to a backend service will introduce at least 0.5 ms of response time due to datacenter RTA, so once you hit 250 queries, that's that. And 250 queries are just one n+1 problem somewhere.
- syrrim 9y agoThe OP says the call is CPU bounded, which suggests that even if time is spent on the network, it is a minority of the total time.
- dpisk 9y agoThis reminds me of an article I read a while back: https://hackernoon.com/server-side-rendering-shootout-with-marko-preact-rax-react-and-vue-25e1ae17800f https://hackernoon.com/server-side-rendering-shootout-with-m... Not sure if the benchmarks still hold now that React 16 is out, but there's definitely overhead in the general approach. > HTTP can only send strings/bytes, so it makes sense to start there and skip the overhead of building up a virtual DOM representation first. There’s a reason string based templating languages are so much faster than our modern frameworks using a virtual DOM implementation.