[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: |
Martin Jansche |
Subject: |
Re: [Help-gsl] Timing issues when calling GSL through Java |
Date: |
Fri, 22 Feb 2008 00:35:24 -0500 |
What JVM do you use? IIRC, the math routines improved quite a bit in
speed in 1.5 and 1.6. You're also right that they may be less precise
(as of JDK 1.3, I believe). You might want to try to run your
benchmark with StrictMath instead of Math.
-- mj
On 2/21/08, David Lindelöf <address@hidden> wrote:
> Dear all,
>
> I'm building Java wrapper classes around GSL, the so-called Java GSL
> project (http://sf.net/projects/jgsl/).
>
> So far I've been able to implement the special functions, including the
> proper handling of the result structures, but when timing the GSL
> against Java's built-in Math library I get results that are consistently
> slower than Java. Calling GSL's logarithm functions through my wrapper
> classes, for instance, is typically three times slower than Java's
> Math.log().
>
> Of course I expect some overhead from the calls through intermediate JNI
> wrapper classes, but Math.log() does the same.
>
> Here is the output from one of my unit tests. Each time I generate a
> random sample of 2000000 numbers, and let JGSL and Java do the
> number-crunching.
>
> Running ch.visnet.jgsl.sf.TestLog
> JGSL computes 2000000 logarithms in 333 ms.
> Java computes 2000000 logarithms in 98 ms.
> JGSL computes 2000000 absolute logarithms in 461 ms.
> Java computes 2000000 absolute logarithms in 130 ms.
> JGSL computes 2000000 log(1+x) in 436 ms.
> Java computes 2000000 log(1+x) in 336 ms.
>
> Does anyone know why GSL's log functions would be slower than Java's
> native ones? Are they more precise? If so, how could I test it?
>
> Kind regards,
>
> David
>
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>