Sha256: b0f53d99435a502dfcb24f42f500cb0b4cda238048f08a7bfa30f0a7cc5e8129
Contents?: true
Size: 518 Bytes
Versions: 38
Compression:
Stored size: 518 Bytes
Contents
if RUBY_PLATFORM == 'opal' class Benchmark def self.bm(iterations=1) puts "BM" times = [] total_time = nil result = nil iterations.times do start_time = `Date.now()` result = yield end_time = `Date.now()` total_time = `end_time - start_time` times << total_time end if iterations == 1 puts "TOTAL TIME: #{total_time}ms" else puts "Times: #{times.inspect}" end return result end end end
Version data entries
38 entries across 38 versions & 1 rubygems