Created
September 28, 2012 17:55
-
-
Save jonleighton/3801265 to your computer and use it in GitHub Desktop.
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 'active_record' | |
| require 'benchmark/ips' | |
| ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
| class Post < ActiveRecord::Base | |
| connection.create_table :posts do |t| | |
| t.string :name | |
| end | |
| end | |
| p = Post.create! name: 'omg' | |
| Benchmark.ips do |r| | |
| r.report('access') { p.name } | |
| end |
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
| Calculating ------------------------------------- | |
| access 6534 i/100ms | |
| ------------------------------------------------- | |
| access 420970.0 (±21.1%) i/s - 1927530 in 4.987156s |
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
| Calculating ------------------------------------- | |
| access 8583 i/100ms | |
| ------------------------------------------------- | |
| access 1540592.1 (±1.1%) i/s - 7681785 in 4.987032s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment