3 ms·
I assume you only measured JRuby at low n, where the startup and warmup time would overshadow overall performance. JRuby is usually significantly faster than C
by headius 11y ago
I assume you only measured JRuby at low n, where the startup and warmup time would overshadow overall performance. JRuby is usually significantly faster than C Ruby. In this case, it's nearly twice as fast:
[] ~/projects/jruby $ time jruby primes.rb
Number of primes in the interval [0,67108864]: 3957809
real 6m26.536s
user 6m43.472s
sys 0m4.967s
[] ~/projects/jruby $ time rvm ruby-2.2 do ruby primes.rb
Number of primes in the interval [0,67108864]: 3957809
real 11m17.610s
user 11m16.564s
sys 0m0.738s