Sha256: 8aedc6dccfe54826d1a9da7594710efb47724b2b53939f4b0f00e67b615647fd

Contents?: true

Size: 848 Bytes

Versions: 10

Compression:

Stored size: 848 Bytes

Contents

$LOAD_PATH << File.dirname(__FILE__) + "/../lib"

require 'bonsai'
require 'benchmark'

Bonsai.root_dir = File.dirname(__FILE__) + "/../spec/support"
Bonsai.config = { :enable_logging => false }

page = Bonsai::Page.find("about-us/history")

Benchmark.bm do |b|
  b.report "all" do
    1_000.times do
      Bonsai::Page.all
    end
  end
  
  b.report "find" do
    10_000.times do
      Bonsai::Page.find("about-us/history")
    end
  end
  
  b.report "parent" do
    10_000.times do
      page.parent
    end
  end
  
  b.report "children" do
    10_000.times do
      page.children
    end
  end
  
  b.report "siblings" do
    10_000.times do
      page.siblings
    end
  end
  
  b.report "ancestors" do
    10_000.times do
      page.ancestors
    end
  end
  
  b.report "rendering" do
    1000.times do
      page.render
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bonsai-1.4.9 benchmark/associations.rb
bonsai-1.4.8 benchmark/associations.rb
bonsai-1.4.7 benchmark/associations.rb
bonsai-1.4.6 benchmark/associations.rb
bonsai-1.4.5 benchmark/associations.rb
bonsai-1.4.4 benchmark/associations.rb
bonsai-1.4.3 benchmark/associations.rb
bonsai-1.4.2 benchmark/associations.rb
bonsai-1.4.1 benchmark/associations.rb
bonsai-1.3.2 benchmark/associations.rb