Peter K Chan wrote:
You are fast! :)
http://jira.codehaus.org/browse/JRUBY-2477
It will be fixed on trunk momentarily. It does introduce a small perf
hit for polymorphic method calls, but if we add a sprinkle of profiling
into the call sites we can have polymorphic calls just fall back on no
caching, eliminating this cost.
Monomorphic algorithms (fib et al) do not appear to be negatively
affected (or it's small enough to look like noise).
Without patch:
user system total real
16.013000 0.000000 16.013000 ( 16.013000)
16.358000 0.000000 16.358000 ( 16.358000)
With patch:
user system total real
18.959000 0.000000 18.959000 ( 18.959000)
18.313000 0.000000 18.313000 ( 18.313000)
Code:
class C1
def m
1
end
end
class C2
def m
2
end
end
o1 = C1.new
o2 = C2.new
require 'benchmark'
Benchmark.bm {|bm|
10.times {
bm.report {
i=0
while i<6000000 # benchmark loop 2
o = (i % 2 == 0) ? o1 : o2
o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
i+=1
end
}
}
}
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email