Sha256: fa9b0ded0e9dddb9b1c6be92d0aabcd0d0e4cc8217e3de0c5f696007d535edcd

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 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.05799508094787598
#   2.315906047821045
#   2.786252021789551
#   5.190935850143433

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stack_tracy-0.1.2 benchmarks/benchmark.rb
stack_tracy-0.1.1 benchmarks/benchmark.rb
stack_tracy-0.1.0 benchmarks/benchmark.rb