my crude benchmark results

Ranjit Mathew rmathew@gmail.com
Tue Jul 13 08:13:00 GMT 2004


John Gabriele wrote:
> for ( int i = 0; i < SIZE; ++i )
> {
> nums[i] = Math.random() * 3.14159 / 2.0;
> }

I note that at least on the 3.4 branch and mainline,
Math.random() is a synchronised method, so the loop
above represents acquiring a lock on java.lang.Math
and releasing it 50,000 times!
If you want to eliminate this factor, you can perhaps
write out a pre-computed array and link that in. You'll
also have to do it for the C version, just to be fair.
Ranjit.
-- 
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /