aboutsummaryrefslogtreecommitdiffstats
path: root/lib/benchmark.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-23 19:45:09 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-23 19:45:09 +0000
commit8fded5ba3e464277eb5bce0717a168ae53f3d0f6 (patch)
tree7024c059cd9436508bc7690f293384fd5de5c635 /lib/benchmark.rb
parent7d8175a2dc37592d97b370caa185868405db5dab (diff)
downloadruby-8fded5ba3e464277eb5bce0717a168ae53f3d0f6.tar.gz
* lib/benchmark.rb: split executable code into sample directory.
* sample/benchmark.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/benchmark.rb')
-rw-r--r--lib/benchmark.rb20
1 files changed, 0 insertions, 20 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 81ca0bcede..bd3b07284f 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -546,23 +546,3 @@ module Benchmark
# The default format string used to display times. See also Benchmark::Tms#format.
FORMAT = Benchmark::Tms::FORMAT
end
-
-if __FILE__ == $0
- include Benchmark
-
- n = ARGV[0].to_i.nonzero? || 50000
- puts %Q([#{n} times iterations of `a = "1"'])
- benchmark(CAPTION, 7, FORMAT) do |x|
- x.report("for:") {for _ in 1..n; _ = "1"; end} # Benchmark.measure
- x.report("times:") {n.times do ; _ = "1"; end}
- x.report("upto:") {1.upto(n) do ; _ = "1"; end}
- end
-
- benchmark do
- [
- measure{for _ in 1..n; _ = "1"; end}, # Benchmark.measure
- measure{n.times do ; _ = "1"; end},
- measure{1.upto(n) do ; _ = "1"; end}
- ]
- end
-end