Performance benchmarks comparing uWestJS against Express and Fastify.
From the project root:
# Quick benchmark (10s per scenario)
npm run benchmark:quick
# Full benchmark (20s per scenario, saves to results.md)
npm run benchmark
# Test setup
npm run benchmark:testOr from the benchmarks directory:
# Install dependencies
npm install
# Run quick benchmark (10s per scenario)
npm run benchmark:quick
# Run full benchmark (20s per scenario, saves to results.md)
npm run benchmark
# Test setup
npm testFor historical tracking and comparison (typically used by CI/CD):
# Save current results to history
npm run benchmark:save
# Compare current results with last 5 runs
npm run benchmark:compareThese commands are automatically run by the CI/CD pipeline. See Historical Tracking section for details.
- Node.js 24 or 25
- wrk (HTTP benchmarking tool)
- Linux:
sudo apt-get install wrk - macOS:
brew install wrk - Windows: Use WSL
- Linux:
-
hello-world - Simple text response
- Tests raw request/response performance
- Minimal overhead, pure framework speed
-
json-response - JSON serialization
- Tests JSON serialization performance
- Includes nested objects and arrays
-
static-file - Static file serving (10KB)
- Tests file serving performance
- Measures throughput for static assets
-
mixed-response - Mixed response types
- Tests different response types (JSON, text, errors)
- Includes query parameters and status codes
-
query-params - Query string parsing
- Tests query parameter extraction
- Multiple parameters with different types
-
post-json - POST body parsing
- Tests JSON body parsing performance
- Uses Lua script for POST requests
- Echo back parsed data
-
headers - Header access
- Tests request header reading
- Multiple header access patterns
-
route-params - Path parameters
- Tests route parameter extraction
- Nested path parameters (/users/:id/posts/:postId)
uWestJS consistently outperforms Express and Fastify:
- 1.6x - 2.1x faster than Express
- 1.6x - 2.0x faster than Fastify
See results.md for detailed benchmark results.
Benchmark results are automatically saved to history/ directory with:
- Timestamp and commit hash
- Node.js version and platform
- Results for all scenarios
# Compare current results with last 5 runs
npm run benchmark:compare
# Save current results to history
npm run benchmark:saveThe CI/CD pipeline automatically:
- Saves results to history on main branch
- Compares PR results against baseline
- Flags >10% performance regressions
scenarios/- Benchmark scenarioswrk-scripts/- Lua scripts for wrk (POST requests, etc.)server.js- Framework server spawnerrun.js- Main benchmark runnertest-setup.js- Quick validation scriptsave-history.js- Save results to historycompare-history.js- Compare with historical datagenerate-detailed-report.js- Generate detailed metrics report
Benchmarks run automatically on:
- Pull requests (posts results as comment)
- Pushes to main/master
- Manual workflow dispatch
See .github/workflows/benchmark.yml for configuration.