Sha256: c464858b626c955b378a76a4f496030ad5f9d9156cd4d0682629424482e8750a

Contents?: true

Size: 818 Bytes

Versions: 7

Compression:

Stored size: 818 Bytes

Contents

require 'lib/bonsai'
require 'benchmark'

Bonsai.root_dir = File.dirname(__FILE__) + "/../spec/support"
Bonsai.configure {|config| 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

7 entries across 7 versions & 1 rubygems

Version Path
bonsai-1.1.4 benchmark/associations.rb
bonsai-1.1.3 benchmark/associations.rb
bonsai-1.1.2 benchmark/associations.rb
bonsai-1.1.1 benchmark/associations.rb
bonsai-1.1.0 benchmark/associations.rb
bonsai-1.0.1 benchmark/associations.rb
bonsai-1.0.0 benchmark/associations.rb