Sha256: acd2e06d649d7ba9ec050a16f9019db91080f85588a0b356ff88bfce9ed28866

Contents?: true

Size: 945 Bytes

Versions: 6

Compression:

Stored size: 945 Bytes

Contents

require File.expand_path('../extras', __FILE__)
require 'rbench'
FACTOR = 10

RBench.run(TIMES) do

  column :times
  column :default
  column :no_slug
  column :slug
  column :cached_slug

  report 'find model by id', (TIMES * FACTOR).ceil do
    default { User.find(get_id) }
    no_slug { User.find(USERS.rand) }
    slug { Post.find(POSTS.rand) }
    cached_slug { District.find(DISTRICTS.rand) }
  end

  report 'find model using array of ids', (TIMES * FACTOR).ceil do
    default { User.find(get_id(2)) }
    no_slug { User.find(USERS.rand(2)) }
    slug { Post.find(POSTS.rand(2)) }
    cached_slug { District.find(DISTRICTS.rand(2)) }
  end

  report 'find model using id, then to_param', (TIMES * FACTOR).ceil do
    default { User.find(get_id).to_param }
    no_slug { User.find(USERS.rand).to_param }
    slug { Post.find(POSTS.rand).to_param }
    cached_slug { District.find(DISTRICTS.rand).to_param }
  end

  summary 'Total'

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cmassimo-friendly_id-3.0.4.2 extras/bench.rb
friendly_id-3.0.6 extras/bench.rb
friendly_id-3.0.5 extras/bench.rb
friendly_id-3.0.4 extras/bench.rb
friendly_id-3.0.3 extras/bench.rb
friendly_id-3.0.2 extras/bench.rb