Use no-hydration SSR methods for better comparison (React renderToStaticMarkup
for example)
#13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For React and hydration-based frameworks, I think it's not apple to apple comparison with those that do not hydrate.
Frameworks like React have methods for generating HTML not meant to be hydrated, that may perform better than
renderToString
, and using those would be a better apple to apple comparison with fastify-html, fastify-htmx etc.Note: even though it's not the common case, it's perfectly valid to use React as a server-side templating framework. This is how Docusaurus v1 used to work: it didn't hydrate React on the client.
I think to be fair, it makes sense to expose benchmark results for both modes when possible: React with/without hydration capacity.
ReactDOMServer.renderToStaticMarkup is a stable method you can use today, but it marginally improves performance according to what I see (only 1-5%?)
ReactMarkup.experimental_renderToHTML
is its upcoming successor (not sure it will be in React 19 stable?) but isn't significantly faster either.I'm mostly opening this PR as a POC not meant to be merged, and aiming to open the discussion on hydration vs no hydration which may lead to different SSR performance for each framework.