react/fixtures/fizz
Josh Story fa58002262
[Fizz] Pipeable Stream Perf (#24291)
* Add fixture for comparing baseline render perf for renderToString and renderToPipeableStream

Modified from ssr2 and https://github.com/SuperOleg39/react-ssr-perf-test

* Implement buffering in pipeable streams

The previous implementation of pipeable streaming (Node) suffered some performance issues brought about by the high chunk counts and innefficiencies with how node streams handle this situation. In particular the use of cork/uncork was meant to alleviate this but these methods do not do anything unless the receiving Writable Stream implements _writev which many won't.

This change adopts the view based buffering techniques previously implemented for the Browser execution context. The main difference is the use of backpressure provided by the writable stream which is not implementable in the other context. Another change to note is the use of standards constructs like TextEncoder and TypedArrays.

* Implement encodeInto during flushCompletedQueues

encodeInto allows us to write directly to the view buffer that will end up getting streamed instead of encoding into an intermediate buffer and then copying that data.
2022-04-11 09:13:44 -07:00
..
public [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
scripts [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
server [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
src [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
README.md [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
package.json [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00
yarn.lock [Fizz] Pipeable Stream Perf (#24291) 2022-04-11 09:13:44 -07:00

README.md

Fizz Fixtures

A set of basic tests for Fizz primarily focussed on baseline perfomrance of legacy renderToString and streaming implementations.

Setup

To reference a local build of React, first run npm run build at the root of the React project. Then:

cd fixtures/fizz
yarn
yarn start

The start command runs a webpack dev server and a server-side rendering server in development mode with hot reloading.

Note: whenever you make changes to React and rebuild it, you need to re-run yarn in this folder:

yarn

If you want to try the production mode instead run:

yarn start:prod

This will pre-build all static resources and then start a server-side rendering HTTP server that hosts the React app and service the static resources (without hot reloading).