renderToString
is single-threaded, synchronous, and CPU bound, so more CPU cores won’t help.
Server rendering and client rendering share code, alothough some code is not necessary on the server side. For instance, no need to track virtual DOM, Event handlers on Server side.
Change node index.js
to NODE_ENV=production node index.js
production
modeUse minified React.js
react-dom/server
to react/dist/react.min
for ReactDOMServerBabel Transforms
Constant Elements
(CE) and Inline Elements
(IE). CE finds constant JSX elements and hoists them to a higher scope so they are not re-instantiated every time the render method runs. And IE gets rid of all calls to React.createElement and replaces them with literal objects.transform-react-constant-elements
, transforms-react-inline-elements
] Note. CE should be put before IE.Avoid React.createClass
Streaming
Chunked Encoding
HTTP/1.1 (1999)react-dom-stream
Cache Components
Object.keys() v.s. Object.getOwnPropertyNames() When talking about Object’s properties, there are two types, namely enumerable one and unenumerable one. It is called enumerability of properties...