Comparison of server side rendering React.
# run Node.js app by
npx ts-node index.node.tsx
# run Bun app by
bun run index.bun.tsx
Both apps is HTTP servers that renders react tree and respond html page:
Node.js
app based on express.Bun
app base onBun.serve
.
Each server has next routes:
/
- usesrenderToString
/string
- usesrenderToString
/stream
- usesrenderToPipeableStream
in Node.js andrenderToReadableStream
in Bun
Used command:
# for Node.js
ab -n 500 -c 100 http://127.0.0.1:8090/
# for Bun
ab -n 500 -c 100 http://127.0.0.1:8090/
In macos via builtin ab
program there is approximately the same number of receipts per second and response speed.