Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bench/java/bench_java_overloaded_invocation.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

import java.lang.Math

Benchmark.bm(40) {|bm|
Benchmark.bm(45) {|bm|
# Math.abs computation cost is negligible for these tests
(ARGV[0] || 5).to_i.times {
bm.report("Control") {
@@ -41,5 +41,10 @@
value = 2.0 ** 128
10_000_000.times { m.abs(value) }
}
bm.report("Contended Math.abs with double-ranged Float") {
m = Math
value = 2.0 ** 128
10.times.map {|i| Thread.new { 1_000_000.times { m.abs(value) } } }.each(&:join)
}
}
}
}

0 comments on commit b7bf353

Please sign in to comment.