Sha256: 3009b364423ff88e81c30e9a9b3b74e114427d4910f06ec07d797e233514de1d

Contents?: true

Size: 768 Bytes

Versions: 14

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

require 'benchmark/ips'

Benchmark.ips do |bench|
  bench.report("Process.clock_gettime in milliseconds (int)") do
    Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
  end

  bench.report("Process.clock_gettime in milliseconds (float)") do
    Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
  end

  bench.report("Process.clock_gettime in seconds (float), multiplied by 1000") do
    1000 * Process.clock_gettime(Process::CLOCK_MONOTONIC)
  end

  bench.report("Process.clock_gettime in seconds (float), multiplied by 1000.0") do
    1000.0 * Process.clock_gettime(Process::CLOCK_MONOTONIC)
  end

  bench.report("Time.now, multiplied by 1000") do
    1000 * Time.now.to_f
  end

  bench.compare!
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
statsd-instrument-3.0.2 test/benchmark/clock_gettime.rb
statsd-instrument-3.0.1 test/benchmark/clock_gettime.rb
statsd-instrument-3.0.0 test/benchmark/clock_gettime.rb
statsd-instrument-3.0.0.pre2 test/benchmark/clock_gettime.rb
statsd-instrument-2.9.2 test/benchmark/clock_gettime.rb
statsd-instrument-3.0.0.pre1 test/benchmark/clock_gettime.rb
statsd-instrument-2.9.1 test/benchmark/clock_gettime.rb
statsd-instrument-2.9.0 test/benchmark/clock_gettime.rb
statsd-instrument-2.8.0 test/benchmark/clock_gettime.rb
statsd-instrument-2.7.1 test/benchmark/clock_gettime.rb
statsd-instrument-2.7.0 test/benchmark/clock_gettime.rb
statsd-instrument-2.6.0 test/benchmark/clock_gettime.rb
statsd-instrument-2.5.1 test/benchmark/clock_gettime.rb
statsd-instrument-2.5.0 test/benchmark/clock_gettime.rb