Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Friendly Id Benchmarks
Git revision: 9b395bad80da30f0101e5df91cc9d18aeac2b3c1
$ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.0.rb DB=postgres bundle exec rake bench
------------------------------------------------------------------------
Using ruby 2.0.0 AR 4.0.0 with postgres
Rehearsal ----------------------------------------------------------------------------------
find (without FriendlyId) 0.340000 0.030000 0.370000 ( 0.473857)
find (in-table slug) 0.990000 0.040000 1.030000 ( 1.285145)
find (in-table slug; included FinderMethods) 0.420000 0.020000 0.440000 ( 0.663232)
find (external slug) 1.630000 0.050000 1.680000 ( 2.194663)
insert (without FriendlyId) 1.000000 0.080000 1.080000 ( 1.356241)
insert (in-table-slug) 3.130000 0.130000 3.260000 ( 3.921744)
insert (in-table-slug; included FinderMethods) 1.000000 0.080000 1.080000 ( 1.365883)
insert (external slug) 8.290000 0.310000 8.600000 ( 10.800216)
------------------------------------------------------------------------ total: 17.540000sec
user system total real
find (without FriendlyId) 0.290000 0.030000 0.320000 ( 0.423382)
find (in-table slug) 0.900000 0.030000 0.930000 ( 1.222101)
find (in-table slug; included FinderMethods) 0.430000 0.030000 0.460000 ( 0.703448)
find (external slug) 1.580000 0.040000 1.620000 ( 2.144805)
insert (without FriendlyId) 0.660000 0.070000 0.730000 ( 1.049766)
insert (in-table-slug) 3.060000 0.130000 3.190000 ( 3.845923)
insert (in-table-slug; included FinderMethods) 0.700000 0.070000 0.770000 ( 1.048894)
insert (external slug) 8.350000 0.330000 8.680000 ( 11.089634)
@bartz

This comment has been minimized.

Show comment Hide comment
@bartz

bartz Sep 11, 2011

What tests yielded these benchmarks?

bartz commented Sep 11, 2011

What tests yielded these benchmarks?

@norman

This comment has been minimized.

Show comment Hide comment
@norman

norman Sep 11, 2011

Owner

norman commented Sep 11, 2011

@hubsmoke

This comment has been minimized.

Show comment Hide comment
@hubsmoke

hubsmoke Sep 22, 2011

Is there an index on the primary key?

Is there an index on the primary key?

@norman

This comment has been minimized.

Show comment Hide comment
@norman

norman Sep 22, 2011

In all SQL databases I'm familiar with, primary key constraints are implemented as a unique index. So, unless I'm mistaken in thinking that SQLite3 does this, then yes.

Owner

norman commented Sep 22, 2011

In all SQL databases I'm familiar with, primary key constraints are implemented as a unique index. So, unless I'm mistaken in thinking that SQLite3 does this, then yes.

@Zorbash

This comment has been minimized.

Show comment Hide comment
@Zorbash

Zorbash Oct 3, 2012

I think @hubsmoke wanted to ask if there is an index on the slug column. Is there?

Zorbash commented Oct 3, 2012

I think @hubsmoke wanted to ask if there is an index on the slug column. Is there?

@dmitry

This comment has been minimized.

Show comment Hide comment
@dmitry

dmitry Feb 1, 2013

@Zorbash to tell @norman to join a discussion with @hubsmoke you need to use @ symbol. :)

dmitry commented Feb 1, 2013

@Zorbash to tell @norman to join a discussion with @hubsmoke you need to use @ symbol. :)

@kfirshay

This comment has been minimized.

Show comment Hide comment
@kfirshay

kfirshay Apr 18, 2014

@norman Did you notice that the benchmark specify postgres explicitly. I am confused why we are talking about SQLite here?!

@norman Did you notice that the benchmark specify postgres explicitly. I am confused why we are talking about SQLite here?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment