Sha256: b447ad8a261dea6f1aacdc33631471bcabed39c36f21ee555cfc02db08b1d47d

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

require 'gravatarify'
require 'benchmark'

include Gravatarify::Helper
  
emails = ['foo@bar.com', 'foobar_didum_asdf@asdasd.com',
          'ASDASDSA@aasd_ASDSAd.com', ' sad@asdASdssasd.ch', ' didum@asdasd.com  ']
n = 10000
Benchmark.bm(23) do |bm|
  bm.report("gravatar_url w/o args: ") { for i in 1..n do gravatar_url(emails[i % 5]) end }
  bm.report("gravatar_url w/ args:  ") { for i in 1..n do gravatar_url(emails[i % 5], :size => 30, :x => 'foo', 'other' => 'abcdef') end }
  bm.report("gravatar_tag w/o args: ") { for i in 1..n do gravatar_tag(emails[i % 5]) end }
  bm.report("gravatar_tag w/ args:  ") { for i in 1..n do gravatar_tag(emails[i % 5], :size => 30, :x => 'foo', :html => { :class => 'abcdef'}) end }  
end
puts "                         -> each measured #{n} times using for-loop"

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gravatarify-3.1.1 test/benchmark/benchmark.rb
gravatarify-3.1.0 test/benchmark/benchmark.rb
gravatarify-3.0.0 test/benchmark/benchmark.rb
gravatarify-2.2.2 test/benchmark/benchmark.rb
gravatarify-2.2.1 test/benchmark/benchmark.rb
gravatarify-2.1.0 test/benchmark/benchmark.rb