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