-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
- jruby 9.0.5.0 (2.2.3) 2016-04-20 fffffff OpenJDK 64-Bit Server VM 24.95-b01 on 1.7.0_95-b00 +jit [linux-amd64]
- Linux example.org 3.16.0-70-generic Remove fileno map entries when closing a RubyIO (JRUBY-6137) #90~14.04.1-Ubuntu SMP Wed Apr 6 22:56:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
** should have comparable benchmark for Integers as *
Actual Behavior
Benchmarks show ** is an order of magnitude slower than * for Integers, and Integer ** Integer is slower than Float ** Integer
test.rb:
require 'benchmark'
$r = 1_000_000
Benchmark.bmbm do |x|
x.report('1') { $r.times { 3 ** 3 }}
x.report('2') { $r.times { 3.0 ** 3 }}
x.report('3') { $r.times { 3 * 3 * 3 }}
end
MRI:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
Rehearsal -------------------------------------
1 0.060000 0.000000 0.060000 ( 0.059568)
2 0.110000 0.000000 0.110000 ( 0.105355)
3 0.050000 0.000000 0.050000 ( 0.055801)
---------------------------- total: 0.220000sec
user system total real
1 0.070000 0.000000 0.070000 ( 0.061776)
2 0.100000 0.000000 0.100000 ( 0.104227)
3 0.060000 0.000000 0.060000 ( 0.054408)
jruby:
jruby 9.0.5.0 (2.2.3) 2016-04-20 fffffff OpenJDK 64-Bit Server VM 24.95-b01 on 1.7.0_95-b00 +jit [linux-amd64]
Rehearsal -------------------------------------
1 0.520000 0.020000 0.540000 ( 0.323665)
2 0.150000 0.000000 0.150000 ( 0.115306)
3 0.050000 0.000000 0.050000 ( 0.038388)
---------------------------- total: 0.740000sec
user system total real
1 0.210000 0.020000 0.230000 ( 0.191466)
2 0.100000 0.000000 0.100000 ( 0.094042)
3 0.020000 0.000000 0.020000 ( 0.024104)
Originally reported here
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels