¶ ↑
r10kr10k provides comparative benchmarks for many ruby web application frameworks with 10, 100, 1000, and 10,000 routes. Here are the currently supported frameworks:
- cuba
-
Cuba (cuba.is)
- hanami
-
Hanami (hanamirb.org/)
- nyny
-
NYNY (github.com/alisnic/nyny)
- rack-app
-
Rack::App (github.com/rack-app/rack-app)
- rails
-
Ruby on Rails (rubyonrails.org/)
- roda
-
Roda (roda.jeremyevans.net)
- sinatra
-
Sinatra (www.sinatrarb.com/)
- syro
-
Syro (soveran.github.io/syro/)
- synfeld
-
Synfeld (github.com/swerling/synfeld)
- watts
-
Watts (github.com/pete/watts)
These frameworks are designed to be run with the default settings. There are some variants that can be run with non-default settings:
- static-route
-
A basic static routing implementation, for maximum performance
- hanami-api
-
Hanami, using hanami-api gem
- rails-minimal-middleware
-
Rails, with most middleware removed
- roda-hash-routes
-
Roda, using the hash_routes plugins
- roda-multi-route
-
Roda, using the multi_route plugin
- roda-osm
-
Roda, using optimized_string_matchers plugin
- roda-run
-
Roda, using separate Roda applications per branch
- roda-static-routing
-
Roda, using the static_routing plugin
- sinatra-minimal-middleware
-
Sinatra, using the minimum middleware
The frameworks that are tested by default are:
static-route syro roda cuba hanami rails sinatra rack-app watts
¶ ↑
InstallationAfter cloning the repository, install the related gems:
gem install gruff # if you want to create the graphs gem install roda sinatra rails cuba syro hanami # frameworks to test
A Gemfile is not used, because all webframeworks are tested independently, and with a Gemfile, bundler assumes all gems must be able to work together.
¶ ↑
UsageTo use:
rake bench graphs
Note that rake bench can take quite a long time, especially on slower hardware.
If you only want to benchmark specific apps, set the R10K_APPS environment variable:
rake bench graphs R10K_APPS="roda cuba"
The builders directory contains the files that build the applications. If you want to examine the application files used for benchmarking, you can use the build task and then look in the apps directory. The bench task produces CSV files which are stored in the data directory. The graphs task takes those CSV files and turns them into nice looking graphs (using gruff).
Environment variables:
- CHECK
-
Check that the built apps return the expected values
- DIM
-
Dimensions for the graphs (default: 1280x720)
- LEVELS
-
The number of levels for the routes (default: 4)
- LEGEND_FONT_SIZE
-
Override base font size for legend text in graphs
- R10K_APPS
-
Which applications/configurations to benchmark
- R10K_ITERATIONS
-
The number of iterations to run (default: 2)
- R10K_NUM_THREADS
-
The number of threads to run (default: 1)
- R10K_WARMUP_ITERATIONS
-
The number of warmup iterations to run (default: 0)
- ROUTES_PER_LEVEL
-
The number of routes in each level (default: 10)
Total number of routes in largest application is ROUTES_PER_LEVEL**LEVELS.
¶ ↑
NOTESIt forked from github.com/jeremyevans/r10k. Made benchmarks on MacBook Pro (Retina, 13-inch, Early 2015) 2,7 GHz Dual-Core Intel Core i5 16 GB 1867 MHz DDR3
¶ ↑
LicenseMIT
¶ ↑
AuthorJeremy Evans <[email protected]>