Skip to content

Instantly share code, notes, and snippets.

@mattetti
Created February 23, 2012 02:46
Show Gist options
  • Save mattetti/1889403 to your computer and use it in GitHub Desktop.
Save mattetti/1889403 to your computer and use it in GitHub Desktop.
Object initialization benchmark - Ruby Class vs Hash vs ActiveRecord vs Datamapper vs Sequel
| Class | Hash | AR 3.2.1 | AR no protection | Datamapper | Sequel |
--------------------------------------------------------------------------------------------------------------------------------------
.new() x100000 | 0.037 | 0.049 | 1.557 | 1.536 | 0.027 | 0.209 |
.new({:id=>1, :title=>"Foo", :text=>"Bar"}) x100000 | 0.327 | 0.038 | 6.784 | 5.972 | 4.226 | 1.986 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment