Skip to content

Instantly share code, notes, and snippets.

@miloops
Created July 28, 2010 15:47
Show Gist options
  • Save miloops/494957 to your computer and use it in GitHub Desktop.
Save miloops/494957 to your computer and use it in GitHub Desktop.
# using mysql gem
>> puts Benchmark.measure{10.times{ActiveRecord::Base.connection.execute("select * from registrations")}}
1.860000 1.900000 3.760000 ( 25.765718)
# using mysql2 gem
>> puts Benchmark.measure{10.times{ActiveRecord::Base.connection.execute("select * from registrations")}}
1.820000 1.850000 3.670000 ( 18.838711)
# looks really cool, but... we never do that kind of queries, let's get realistic
# using mysql gem
>> puts Benchmark.measure{10000.times{Registration.find(1000)}}
4.460000 0.340000 4.800000 ( 6.569150)
# using mysql2 gem
>> puts Benchmark.measure{10000.times{Registration.find(1000)}}
5.480000 0.380000 5.860000 ( 7.681031)
# :( :emo:
# using mysql gem
>> event = Event.find 'probando-eventio'; puts Benchmark.measure{1000.times{event.registrations.all}}
1.630000 0.130000 1.760000 ( 2.218865)
53:43
# using mysql2 gem
>> event = Event.find 'probando-eventio'; puts Benchmark.measure{1000.times{event.registrations.all}}
3.440000 0.140000 3.580000 ( 4.188297)
# :( !!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment