[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Timing issues when calling GSL through Java

From: David Lindelöf
Subject: Re: [Help-gsl] Timing issues when calling GSL through Java
Date: Fri, 22 Feb 2008 14:47:01 +0100


On Fri, Feb 22, 2008 at 6:35 AM, Martin Jansche <address@hidden> wrote:
> What JVM do you use?  IIRC, the math routines improved quite a bit in
>  speed in 1.5 and 1.6.

I'm using 1.6, and you're right, I remember that 1.4 was slower.

>  (as of JDK 1.3, I believe).  You might want to try to run your
>  benchmark with StrictMath instead of Math.

Well that's funny. I did just that and here are the results:

Running ch.visnet.jgsl.sf.TestLog
JGSL computes 2000000 logarithms in 375 ms.
Java computes 2000000 logarithms in 452 ms.
JGSL computes 2000000 absolute logarithms in 331 ms.
Java computes 2000000 absolute logarithms in 396 ms.
JGSL computes 2000000 log(1+x) in 620 ms.
Java computes 2000000 log(1+x) in 488 ms.

Java is still slightly faster for log(1+x) but definitely slower for
normal logs. An earlier poster (Daniel) mentioned that a JIT compiler
might replace Math.log() with direct call to the C routine, which this
benchmark seems to confirm.

Are there any references I could consult about the relative merits of
GSL in terms of speed and precision compared with the standard C
routine? I'd like to document all this before I release this snapshot.

Kind regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]