This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'strscan' | |
s = "this " * 20 | |
puts "with .scan.each" | |
puts Benchmark.measure { | |
100000.times do | |
s.scan(/\w+[ $]/) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
old-stumpy:Documents josh$ ruby test.rb | |
with create_additions | |
4.270000 0.030000 4.300000 ( 4.348951) | |
4.270000 0.020000 4.290000 ( 4.353974) | |
4.270000 0.030000 4.300000 ( 4.337681) | |
4.280000 0.020000 4.300000 ( 4.316854) | |
4.270000 0.020000 4.290000 ( 4.325486) | |
without create_additions | |
4.210000 0.030000 4.240000 ( 4.284506) | |
4.210000 0.030000 4.240000 ( 4.266183) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_support/core_ext" | |
require "action_controller/new_base/http" | |
require "rack/router" | |
module Rails | |
class Sinatra < ActionController::Http | |
include AbstractController::Renderer | |
include AbstractController::Callbacks | |
include AbstractController::Helpers | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrOrEquals | |
def test | |
@test | |
end | |
def test=(test) | |
@test = test | |
'not test' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rack-router | merb routing | rails routing | usher routing | | |
--Route generation--------------------------------------------------------------------------------------------------------------------------------------------------- | |
A simple string x10000 | 0.149 | 0.145 | 0.450 | 0.098 | | |
A simple string with query parameters x10000 | 0.308 | 0.338 | 0.645 | 0.221 | | |
A couple variable segments x10000 | 0.210 | 0.481 | 0.639 | 0.156 | | |
A lot of variable segments x10000 | 0.289 | 0.395 | 0.853 | 0.351 | | |
Conditions that matches x10000 | 0.219 | 0.335 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router: | |
#initialize(parent_router || nil) | |
#map('path', options = nil) | |
returned object supports attr_accessor :to | |
returned object supports attr_accessor :name | |
#context | |
returns object with attr_reader :host, :port, :scheme, :base_uri | |
#recognize(request_object, path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):007:0> puts app.call(Rack::MockRequest.env_for("/hello")) | |
200 | |
Hello | |
=> nil | |
irb(main):008:0> | |
irb(main):009:0* | |
irb(main):010:0* | |
irb(main):011:0* quit | |
replacement:usher joshua$ irb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rack-router bootup time | usher bootup time | | |
----------------------------------------------------------------------- | |
Awesome x10 | 42.350 | 2.692 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.6.0] | |
user system total real | |
by_define_method 0.680000 0.000000 0.680000 ( 0.700586) | |
by_explicit_definition 0.560000 0.010000 0.570000 ( 0.581977) | |
by_eval 0.550000 0.000000 0.550000 ( 0.553484) | |
by_class_eval 0.540000 0.010000 0.550000 ( 0.561800) | |
by_class_eval_block 0.540000 0.000000 0.540000 ( 0.548041) | |
by_module_eval 0.550000 0.010000 0.560000 ( 0.560635) | |
by_module_eval_block 0.520000 0.000000 0.520000 ( 0.539168) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "rbench" | |
def omg_slow | |
Array['one', 'two', 'three'] | |
end | |
def omg_fast | |
['one', 'two', 'three'] | |
end |
OlderNewer