Sha256: 84004244e36912d95a3bd8ec97224f763c45efe3bce7b1014f1ef78dcdbb514e

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

#
# This benchmark is compared with ruby-prof:
#
#   require 'ruby-prof'
#   require 'benchmark'
#
#   $stdout.sync = true
#
#   puts Benchmark.realtime {
#     100000.times { print ""  }
#   }
#
#   puts Benchmark.realtime {
#     RubyProf.profile do
#       100000.times { print ""  }
#     end
#   }
#
#   for n in [5, 100] do
#     n.times { Thread.new { sleep }}
#     puts Benchmark.realtime {
#       RubyProf.profile do
#         100000.times { print ""  }
#       end
#     }
#   end
#
# $ ruby ruby-prof/benchmarks/benchmark.rb
#   0.061315
#   1.201144
#   1.404983
#   6.558329

$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)

require "benchmark"
require "stack_tracy"

$stdout.sync = true

puts Benchmark.realtime {
  100000.times { print ""  }
}

puts Benchmark.realtime {
  stack_tracy do
    100000.times { print ""  }
  end
}

for n in [5, 100] do
  n.times { Thread.new { sleep }}
  puts Benchmark.realtime {
    stack_tracy do
      100000.times { print ""  }
    end
  }
end

# $ ruby stack_tracy/benchmarks/benchmark.rb
#   0.035907
#   2.096276
#   2.575487
#   4.770742

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stack_tracy-0.1.9 benchmarks/benchmark.rb
stack_tracy-0.1.8 benchmarks/benchmark.rb
stack_tracy-0.1.7 benchmarks/benchmark.rb
stack_tracy-0.1.6 benchmarks/benchmark.rb
stack_tracy-0.1.5 benchmarks/benchmark.rb
stack_tracy-0.1.4 benchmarks/benchmark.rb
stack_tracy-0.1.3 benchmarks/benchmark.rb