Sha256: f6362643bc6b4b1bd5e5f57debd94431c1e4c24437b695175e4dbb1f2381ddb8

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

require 'compsci/node'
require 'compsci/tree'
require 'benchmark/ips'

include CompSci

Benchmark.ips do |b|
  b.config time: 3, warmup: 0.5

  b.report("99x BinaryTree(ChildNode)#push") do
    tree = BinaryTree.new(ChildFlexNode, 42)
    99.times { tree.push rand 99 }
  end

  b.report("99x BinaryTree(FlexNode)#push") do
    tree = BinaryTree.new(FlexNode, 42)
    99.times { tree.push rand 99 }
  end

  b.report("99x TernaryTree(ChildFlexNode)#push") do
    tree = TernaryTree.new(ChildFlexNode, 42)
    99.times { tree.push rand 99 }
  end

  b.report("99x TernaryTree(FlexNode)#push") do
    tree = TernaryTree.new(FlexNode, 42)
    99.times { tree.push rand 99 }
  end

  b.compare!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compsci-0.3.0.1 test/bench/tree.rb
compsci-0.2.0.1 test/bench/tree.rb