Sha256: 178bc0f4c9b2ebe9f38d6d43bc4064680d55939db7347ecd12eee0e3c99bbe6e

Contents?: true

Size: 768 Bytes

Versions: 32

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

32 entries across 32 versions & 1 rubygems

Version Path
statsd-instrument-3.9.7 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.6 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.5 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.4 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.3 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.2 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.1 test/benchmark/clock_gettime.rb
statsd-instrument-3.9.0 test/benchmark/clock_gettime.rb
statsd-instrument-3.8.0 test/benchmark/clock_gettime.rb
statsd-instrument-3.7.0 test/benchmark/clock_gettime.rb
statsd-instrument-3.6.1 test/benchmark/clock_gettime.rb
statsd-instrument-3.6.0 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.12 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.11 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.10 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.9 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.8 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.7 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.6 test/benchmark/clock_gettime.rb
statsd-instrument-3.5.5 test/benchmark/clock_gettime.rb