Runtime Accelerated Rendering Infrastructure
This benchmark suite provides a comprehensive comparison between rari (Rust-powered React Server Components) and Next.js.
- Server-side rendering speed - Time to render all components on server
- Time to First Byte (TTFB) - Server response latency (P50, P95, P99)
- Bundle size comparison - Client-side JavaScript payload
- Build times - Production build speeds
- Concurrent request handling - Throughput under load (requests/sec)
- Memory usage - Runtime memory consumption under load
The benchmark suite tests a single comprehensive homepage route (/) that includes:
- 8 Server Components - Counter, TestComponent, ShoppingList, WhatsHot, EnvTestComponent, FetchExample, ServerWithClient, and Markdown
- Static rendering - All components rendered server-side
- Real-world complexity - Mix of simple and complex components with various rendering patterns
- Node.js 22+
- pnpm (install with
corepack enable) - Rust and Cargo
- just - Command runner (install with
cargo install just)
# One-command setup (installs all dependencies and tools)
just setup
# Or complete initialization (setup + build + compile)
just init# Build both apps for production
just build
# Run complete benchmark suite
just benchmark-all
# Run specific benchmarks
just buildtest
just benchmark
just loadtest
# Quick tests with oha
just quick-test-rari
just quick-test-nextjsTests server-side rendering performance with sequential requests:
- Warmup phase - 50 requests to warm up the server
- Test phase - 20 measured requests
- Metrics collected - Min, max, avg, P50, P95, P99 response times, response size, error rate
Tests concurrent request handling using oha:
- Duration - 30 seconds (configurable)
- Concurrent connections - 50 (configurable)
- Metrics collected - Throughput (req/sec), latency percentiles, error rates, timeouts
Compares production build performance:
- Build command -
pnpm run buildfor both frameworks - Metrics collected - Build duration, bundle size, chunk count, warnings, errors
- Response times - Min, max, avg, P50, P95, P99 (in milliseconds)
- Response size - Average payload size in bytes
- Success rate - Percentage of successful requests
- Error count - Number of failed requests
- Throughput - Requests per second (avg, min, max)
- Latency - Response time percentiles (P50, P90, P95, P99) in milliseconds
- Errors - Failed requests and timeouts
- Duration - Total test duration
- Build time - Total production build duration
- Bundle size - Total size of client-side JavaScript and CSS
- Chunk count - Number of generated files
- Warnings/Errors - Build output analysis
Both applications are configured to be as equivalent as possible:
- App Router with file-based routing
- Single homepage route (
/) with 8 server components - Server components by default
- TypeScript throughout
- Tailwind CSS for styling
- Identical component implementations
- Rust-powered React Server Components runtime
- Vite-based build system
- Production server on port 3000
- Node.js-based React framework
- Turbopack build system
- Production server on port 3001
Based on the latest benchmark run (March 26, 2026):
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Build Time | 1.26s | 3.69s | 65.8% faster |
| Client Bundle | 280.66 KB (6 files) | 633.51 KB (8 files) | 55.7% smaller |
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Average Response Time | 0.08ms | 0.78ms | 89.2% faster |
| P95 Latency | 0.12ms | 0.86ms | 86.0% faster |
| Response Size | 856 bytes | 88,292 bytes | 99.0% smaller |
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Throughput | 71,404.48 req/sec | 1,496.61 req/sec | 4,671.1% higher |
| Average Latency | 0.70ms | 33.42ms | 97.9% faster |
| P95 Latency | 1.19ms | 41.90ms | 97.2% faster |
| Total Requests | 2,142,557 | 44,903 | 4,671.1% more |
| Errors | 0 | 0 | 100% success rate |
| Timeouts | 0 | 0 | 100% success rate |
# Start Rari production server (port 3000)
just start-rari
# Start Next.js production server (port 3001)
just start-nextjs
# Check if servers are running
just check-servers# Run performance benchmark (requires servers to be running)
just benchmark# Run load test (requires servers to be running)
just loadtest
# Quick load tests with custom parameters
just quick-test-rari 30s 100
just quick-test-nextjs 30s 100# Run build time comparison
just buildtest# View latest results
just results
# View specific result types
just results-build
just results-perf
just results-load# Clean build artifacts
just clean
# Clean and rebuild
just rebuild
# Format and check code
just fmt
just check
# Compile benchmark tools
just compileRun just to see all available commands, or just --list for a detailed list.
First-time setup:
just initRunning benchmarks:
# 1. Build the apps
just build
# 2. Start servers (in separate terminals)
just start-rari
just start-nextjs
# 3. Run benchmarks
just benchmark-allQuick iteration:
just rebuild
just buildtest
just check-serversWhen adding new benchmark scenarios:
- Ensure parity - Both apps should have equivalent functionality
- Update both apps - Add components/routes to both rari and nextjs
- Update benchmark tools - Modify the Rust benchmark tools in
tools/benchmark/src/ - Document changes - Update this README with new test scenarios
- Run all tests - Verify with
just benchmark-all
MIT License - see LICENSE for details.