little speed comparisson

there is a little comparison between c++/c, ASM, and Java.

It looked interesting so I decided to post it.

It should be noted that c++ was connected into java by JNI, and ASM library was connected into c++ library. Also on backgroud were running QCD 3, antivirus, and firewall. Test CPU was medochino/dixon (would you believe windows or linux?) overclocked to 453 MHZ

bin\java -server -Xcompile -Xmx1200M jn
4 first attempt 40 second attempt 40 full 160 first attempt 0 second attem
pt 0 full 160 first attempt false second attempt first attempt 144 second att
empt 144 full 160 40

So try to guess what is what. First attempt and second attempt are just control checksums. Timing is that number after full.

All test were done for same task array multiplication. C++ and ASM uset the same array, java used different. (I tried to disalow unpredicable JNI actions)

bin\java -server -Xcompile -Xmx1200M jn
4 first attempt 40 second attempt 40 full 160 first attempt 0 second attem
pt 0 full 110 first attempt false second attempt first attempt 144 second att
empt 144 full 160 40

this was second run.

eehhh ???

care to make some sense and post some clarification or some code or something?

+1 ;D

Speed test C++, ASM, Java

Results first test 160/160/160 ms
second test 160/110/160 ms

basicaly it was something like this

int[] integer=new int[20000000] //it was inicialised to some number

store time
for (int q=0;q<integer.lenght;q++){
integer[q]*=10;
}
print time

quite interesting if you consider that C++ code was generated with /O2 /On flags. If I didn’t botched something. One of results is hotspot actually could do array multiplication quickly

Fairly old news, that.

See Shawn’s more involved real-world math tests for results I have a bit more confidence in.

I won’t go into all the myriad things you need to be careful of to make a test like this even slightly valid AGAIN. Search the boards for the term “Microbenchmark” over the last year and you’ll see them all.

All you are measuring here is the memory cache & bus performance. The work done in the inner loop is so trivial that the read/writes will far outweigh the cost of a multiply - whatever language you use.

  • Dom

This was exactly what I measured. Bus speed. Then when I was in testing, I even measured mul instruction. It was 170 GPI, but I did it just in ASM. (Too many possible optimalisation in JVM. And TOO ugly code in VC6 enterprise)