help-gsl
[Top][All Lists]
Advanced

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

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


From: David Lindelöf
Subject: [Help-gsl] Timing issues when calling GSL through Java
Date: Thu, 21 Feb 2008 20:06:17 +0100

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





reply via email to

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