Hello, today i've spent quite a bit of time reading about SSR performances because I've noticed that running my project with "npm start" and visiting the SSR page (which is now in dev mode ) versus running "npm run build-run" and visiting the SSR page ( which is now in prod mode) gave weird results.
In quite a lot of guides they say that just building react from dev mode to prod mode should give you a 300-400% boost in perfs...
But the more i tried to refresh the page the more for me it felt slower in prod mode.
So i added a simple code to test ReactDOMServer.renderToString(components);
// Full React HTML render
const start2 = ms.now();
const html = ReactDOMServer.renderToString(components);
const end2 = ms.parse(ms.since(start2));
const total2 = end2.microseconds + (end2.milliseconds * 1e3) + (end2.seconds * 1e6);
console.log(`${total2 / 1e3}ms`);
At first I tought that I've must done some errors somewhere.. so today i've updated reactql and started a fresh project and added the bare code needed ro reproduce the issue: in my case i'm rendering a tree data structure with <ul>
s and <li>
s. The more nodes the tree had the slower the production mode would be in executing const html = ReactDOMServer.renderToString(components);
.
TL;DR: Why reactql in Production is slower to run ReactDOMServer.renderToString(components);
than the Dev mode the more components you have to render?
I know this will be hard to read, i'm here if you need me to explain or provide more infos
Edit: apart for the console.log to measure the ms of the function this is the only code i've added:
http://puu.sh/wwFGr/dcb5f6e74d.png
This is issue is quite sersious because in the example i only used stateless components, but this is even more problematic when i need to have also state inside them to handle toggles, collapse, checkboxes, calculations ecc
Edit2: the data i've got
http://puu.sh/wwGey/e424a68cd2.png
And in my real project where the nodes are not this simple is way more problematic. How is this possible that in Prod mode it will take twice the time ?