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 (May 15, 2026):
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Build Time | 1.98s | 4.42s | 55.2% faster |
| Client Bundle | 285.15 KB (6 files) | 634.29 KB (8 files) | 55.0% smaller |
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Average Response Time | 0.13ms | 1.98ms | 93.5% faster |
| P95 Latency | 0.18ms | 2.46ms | 92.7% faster |
| Response Size | 13,089 bytes | 33,058 bytes | 60.4% smaller |
| Metric | rari | Next.js | Improvement |
|---|---|---|---|
| Throughput | 105,698.12 req/sec | 1,462.85 req/sec | 7,125.5% higher |
| Average Latency | 0.47ms | 34.19ms | 98.6% faster |
| P95 Latency | 0.80ms | 42.84ms | 98.1% faster |
| Total Requests | 3,171,807 | 43,891 | 7,125.5% 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.