-
-
Save joshbuddy/177382 to your computer and use it in GitHub Desktop.
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 | |
RBench.run(10_000_000) do | |
column :one, :title => "Using explicit array decl" | |
column :two, :title => "Using implicit array decl" | |
report "Array creation" do | |
one { omg_slow } | |
two { omg_fast } | |
end | |
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
Using explicity array decl | Using implicit array decl | | |
--------------------------------------------------------------------------------------- | |
Array creation 18.628 | 17.832 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment