Skip to content

Instantly share code, notes, and snippets.

@tcopeland
Last active August 29, 2015 14:16
Show Gist options
  • Save tcopeland/119266243876fc0138da to your computer and use it in GitHub Desktop.
Save tcopeland/119266243876fc0138da to your computer and use it in GitHub Desktop.
irb(main):014:0> puts RUBY_VERSION ; n = 5000 ; Benchmark.bm {|x| x.report { n.times {' '.strip.empty?} } ; x.report { n.times { ' ' =~ /^\s*$/ } } }
2.1.5
user system total real
0.010000 0.000000 0.010000 ( 0.007651)
0.000000 0.010000 0.010000 ( 0.005907)
irb(main):016:0> puts RUBY_VERSION ; n = 5000 ; Benchmark.bm {|x| x.report { n.times {' '.strip.empty?} } ; x.report { n.times { ' ' =~ /^\s*$/ } } }
2.2.0
user system total real
0.000000 0.000000 0.000000 ( 0.001773)
0.000000 0.000000 0.000000 ( 0.004745)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment