Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Benchmark and results of Time.new.to_i versus java.lang.System.nanoTime called from JRuby.
Calculating -------------------------------------
Time.new.to_i 106740 i/100ms
System.nanoTime 187876 i/100ms
-------------------------------------------------
Time.new.to_i 5457230.7 (±7.3%) i/s - 27111960 in 5.000000s
System.nanoTime 17952011.5 (±9.2%) i/s - 88301720 in 4.976000s
require 'benchmark/ips'
java_import java.lang.System
Benchmark.ips do |bm|
bm.report('Time.new.to_i') do |n|
while n > 0
Time.new.to_i
n-=1
end
end
bm.report('System.nanoTime') do |n|
while n > 0
System.nano_time
n-=1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.