Sha256: cc3d22984853d3f6a25fc2c96f6e4f28589633dc43908c3064fe69fc83d61b74

Contents?: true

Size: 513 Bytes

Versions: 71

Compression:

Stored size: 513 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

      result
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
volt-0.9.5.pre2 lib/volt/benchmark/benchmark.rb
volt-0.9.5.pre1 lib/volt/benchmark/benchmark.rb
volt-0.9.4 lib/volt/benchmark/benchmark.rb
volt-0.9.4.pre5 lib/volt/benchmark/benchmark.rb
volt-0.9.4.pre3 lib/volt/benchmark/benchmark.rb
volt-0.9.4.pre2 lib/volt/benchmark/benchmark.rb
volt-0.9.4.pre1 lib/volt/benchmark/benchmark.rb
volt-0.9.3 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre6 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre5 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre4 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre3 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre2 lib/volt/benchmark/benchmark.rb
volt-0.9.3.pre1 lib/volt/benchmark/benchmark.rb
volt-0.9.2 lib/volt/benchmark/benchmark.rb
volt-0.9.1 lib/volt/benchmark/benchmark.rb
volt-0.9.1.pre5 lib/volt/benchmark/benchmark.rb
volt-0.9.1.pre4 lib/volt/benchmark/benchmark.rb
volt-0.9.1.pre3 lib/volt/benchmark/benchmark.rb
volt-0.9.1.pre2 lib/volt/benchmark/benchmark.rb