Skip to content

Instantly share code, notes, and snippets.

@wycats
Created June 4, 2010 22:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save wycats/426004 to your computer and use it in GitHub Desktop.
Save wycats/426004 to your computer and use it in GitHub Desktop.
fast: through middleware inserted at 0
slwr: through middleware inserted via @use@
rotr: through endpoint sent via the router
bare: through ActionController::Metal with self.response_body
cntr: through ActionController::Base with self.response_body
text: through ActionController::Base with render :text
tmpl: through ActionController::Base with simple render :template
layt: through ActionController::Base with render :template with layout
Note: These tests are being run without ActiveRecord, which currently
has an extremely slow connection pool implementation. It might
be impossible to improve this implementation, but straight
framework benchmarks should compare reasonably with frameworks
without ORM support
Before any work (with ActiveRecord):
real rps
fast 0.004780 2900
slwr 0.358510 1300
rotr 0.351757 1200
bare 0.476070 1105
cntr 0.745560 695
text 0.978853 570
tmpl 1.110000 539
layt 2.080000 340
Before any work (without ActiveRecord):
* The rest of the optimization work is done without AR
real rps
fast 0.004488 2900
slwr 0.282390 1450
rotr 0.301546 1380
bare 0.367800 1281
cntr 0.639768 800
text 0.860590 650
tmpl 0.973746 610
layt 1.900397 360
After first round:
* Memoize commonly used request methods
* Use faster run_callbacks method
* Eliminate the need to check superclass for callbacks changes each time
* Improve log subscriber by remembering list of loggers
* Small improvement to performance of MessageVerifier
* Use simple Request methods in Logger middleware because the more advanced
versions aren't available yet but are slower anyway
* Stop the flash middleware from pulling in the session even if it's never used
real rps
fast 0.004857 2900
slwr 0.067485 2150
rotr 0.087929 2000
bare 0.154795 1720
cntr 0.462846 950
text 0.675570 800
tmpl 0.742683 725
layt 1.855277 375
Second round:
* Eliminate redundant unescaping
* Slightly improve performance of #unescape
real rps
fast 0.004365 2900
slwr 0.068906 2200
rotr 0.088535 2000
bare 0.118635 1800
cntr 0.377927 1035
text 0.622412 820
tmpl 0.690456 740
layt 1.799501 375
Third round:
* Improve LookupContext, more to come
* Avoid constantly going through the whole PathSet coercion logic
* Add AS::Dependencies.ref, which returns an object you can call #get on to get
the real object
real rps
fast 0.004271 2900
slwr 0.067029 2200
rotr 0.088085 2000
bare 0.103868 1900
cntr 0.355898 1070
text 0.557127 825
tmpl 0.639581 765
layt 1.678789 375
@KieranP
Copy link

KieranP commented Jun 5, 2010

Exceptional work. 550 rps more for Sinatra apps plugged into the router, and 175 rps more for simple actions like AJAX methods that return text :-) Great stuff! Look forward to seeing more :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment