Sha256: f76bfdb1ca06a0fb383c8c1c49de4d9f84781d5bc7ce40750633026579d1dc30
Contents?: true
Size: 452 Bytes
Versions: 1
Compression:
Stored size: 452 Bytes
Contents
#!/usr/bin/ruby require File.join(File.dirname(__FILE__), '..', 'lib', 'threadsafe_benchmark') include ThreadsafeBenchmark threads = [] max_num = 5000 5.to_i.times { |i| threads << Thread.new(max_num) { |n| threadsafe_bm(6) { |x| x.report("for:") { for i in 1..n; a = "1"; end } x.report("times:") { n.times do ; a = "1"; end } x.report("upto:") { 1.upto(n) do ; a = "1"; end } } } } threads.each { |t| t.join }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
threadsafe_benchmark-1.0.0 | samples/iterations.rb |