Created
March 8, 2018 14:45
-
-
Save BitOfUniverse/00423fbfef86f0d4aedccb01d67df083 to your computer and use it in GitHub Desktop.
Ruby benchmark [2.4 vs 2.5]: Lazy Proc allocation for block parameters
This file contains hidden or 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' | |
def with_block(&block); end | |
Benchmark.bmbm(10){|x| | |
x.report("with_block") { 1_000_000.times{ with_block{} } } | |
} | |
# Using /Users/alexey/.rvm/gems/ruby-2.4.2 | |
# ➜ ruby ruby benchmark_ruby_block_passing.rb | |
# user system total real | |
# with_block 0.550000 0.000000 0.550000 ( 0.553924) | |
# Using /Users/alexey/.rvm/gems/ruby-2.5.0 | |
# user system total real | |
# with_block 0.083184 0.000373 0.083557 ( 0.083838) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment