Daniel Cheng wrote:
> On Fri, Apr 3, 2009 at 6:30 AM,  <[email protected]> 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.
> _______________________________________________
> Devl mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

I get similar results; this is with svn-compiled freenet.jar *and* 
freenet-ext.jar

    [junit] ------------- Standard Output ---------------
    [junit] Getting ready for benchmarking
    [junit] Native8Code[k=192,n=256]
    [junit] PureCode[k=192,n=256]
    [junit] Native code took 200ms whereas java's code took 43ms.
    [junit] ------------- ---------------- ---------------

infini...@xl269:~/data0/projects/freenet/trunk/freenet$ uname -a
Linux xl269 2.6.26-1-amd64 #1 SMP Sat Jan 10 17:57:00 UTC 2009 x86_64 GNU/Linux

infini...@xl269:~/data0/projects/freenet/trunk/freenet$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5pre) (6b14-1.5~pre1-5)
OpenJDK 64-Bit Server VM (build 14.0-b10, mixed mode)

but for more accurate results we should write some longer tests, ie. ones which
take minutes, not milliseconds...

X
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to