On Fri, Apr 3, 2009 at 6:30 AM,  <nextgens at freenetproject.org> wrote:
> Author: nextgens
> Date: 2009-04-02 22:30:59 +0000 (Thu, 02 Apr 2009)
> New Revision: 26391
>
> Modified:
> ? trunk/freenet/test/freenet/client/CodeTest.java
> Log:
> Add a benchmark to the junit test; launch it with -Dbenchmark=true
> At the moment it produces weird results:
> ? ?[junit] Getting ready for benchmarking
> ? ?[junit] Native8Code[k=192,n=256]
> ? ?[junit] PureCode[k=192,n=256]
> ? ?[junit] Native code took 239ms whereas java's code took 76ms.

under my profiling:

1) The assertEquals is take more then 25% of time.
2) Randomize the array is taking around 7% of time
3) lots of time are spend on  new byte[]  / new Buffer.

after removing assertEquals and some byte array allocations:
: Native code took 40ms whereas java's code took 2ms.
: Native code took 3ms whereas java's code took 35ms.
: Native code took 4ms whereas java's code took 2ms.
: Native code took 29ms whereas java's code took 3ms.
: Native code took 3ms whereas java's code took 2ms.

These are more just random noises to me.

FYP, I am using the freenet-ext.jar from freenetproject.org.

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)

Using the new libfec8.so give more or less the same result.
If you can reproduce this using other java version / cpu / arch,
maybe we should just drop the native library.

Reply via email to