This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: my crude benchmark results
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: John Gabriele <john3g at bestweb dot net>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 13 Jul 2004 13:40:54 +0530
- Subject: Re: my crude benchmark results
- References: <8C0581DD-D484-11D8-B739-003065776B20@bestweb.net>
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/