RST's software laboratory

Navigation: Home / JMandel /

JMandel - A simple Java vs C++ benchmark

Purpose of this is a comparision of calculation speed of Java V1.5.0 and C. The program mandel.MandelBenchmark runs 5 loops to render the basic mandelbrot set in the range ((-2,1), (-1.5, 1.5)).

Test results with normal (-client) VM args which means Java is slower by factor 1.37!

Testing mandelbrot iteration implemented in java. Time: 1.552s Time: 1.492s Time: 1.482s Time: 1.482s Time: 1.473s

Testing optimized C version of iteration via JNI Time: 1.101s Time: 1.092s Time: 1.111s Time: 1.092s Time: 1.091s

Test results with -server VM arg which means Java is faster by factor 0.69?

Testing mandelbrot iteration implemented in java. Time: 0.771s Time: 0.761s Time: 0.752s Time: 0.751s Time: 0.761s

Testing optimized C version of iteration via JNI, done by RST.

Time: 1.091s Time: 1.092s Time: 1.091s Time: 1.102s Time: 1.092s

Generated Mandelbrot (ASCII Graphic)

!!!!!!!!!!!!!!!!!!!!!!!!!!!"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!"""""""""""""""""""""""""""""########################""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!""""""""""""""""""""##############################################"""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!""""""""""""""""###################################$$$$$$$$$$$$$$#########"""""""""""""""""""""""""""""""
!!!!!!!!!!!!!"""""""""""""#################################$$$$$$$$$%%&'0)&%%%%$$$$$$$########""""""""""""""""""""""""""
!!!!!!!!!!!!""""""""""################################$$$$$$$$$$$%%%%&&'+7-(''()&%$$$$$$$$########""""""""""""""""""""""
!!!!!!!!!!""""""""################################$$$$$$$$$$$$$%%%%%%&''()+0.*)'&&%%$$$$$$$$$#########""""""""""""""""""
!!!!!!!!!"""""""###############################$$$$$$$$$$$$$$%%%%%%&'(+*+1<?80*((&&%%%%$$$$$$$$#########""""""""""""""""
!!!!!!!""""""###############################$$$$$$$$$$$$$$%%%%&&&&'(*,=É??????D3B+'&%%%%%%%$$$$$$##########"""""""""""""
!!!!!!"""""#############################$$$$$$$$$$$$$$%%%&&&&&&'''((*0?????????8,((''&&&&%%%%%%$$$$##########"""""""""""
!!!!!""""############################$$$$$$$$$$$%%%%%&(8*+,.)())20++,-0<??????6.,+*)*-('''''')+&%$$$###########"""""""""
!!!!"""###########################$$$$$$$$%%%%%%%%&&&''544€;C0-2=??????????????????¯??-**+;6+-.+)%%$$############"""""""
!!!!""########################$$$$$%%%%%%%%%%%%&&&&&'((),3??????????????????????????????6????2+)&&%%$$$###########""""""
!!!"#####################$$$$%%%%%%%%%%%%%%%&&&&&&')-11.Y??????????????????????????????????5.+)''&%%%$$$############""""
!!"###############$$$$$$$%%&',,''&&&&&&''''''''''((*,w`??????????????????????????????????????>+)),&%%$$$#############"""
!!########$$$$$$$$$$$%%%%%&&(*/*)**))*9-*))((((())+G????????????????????????????????????????????r5(&%$$$$#############""
!"####$$$$$$$$$$$$%%%%%%%&&''()+/@NM073U?42D.5+*++.U???????????????????????????????????????????6)(&&%$$$$$############""
!##$$$$$$$$$$$$%%%%%%%%&&''')*+-19?????????????U..Y?????????????????????????????????????????????<)&%%$$$$$#############"
!#$$$$$$$$$$$%%%&&&&&'(+,*)*+-2C?????????????????6????????????????????????????????????????????SE(&%%%$$$$$$############"
!$%%%%%%%&''&&&&&''''()*-8BH?5????????????????????????????????????????????????????????????????)'&&%%%$$$$$$############"
!YdWX\bh|?yu~?tz????ºœ???????????????????????????????????????????????????????????????????5-*)('&&%%%$$$$$$#############
!$%%%%%%%&''&&&&&''''()*-8BH?5????????????????????????????????????????????????????????????????)'&&%%%$$$$$$############"
!#$$$$$$$$$$$%%%&&&&&'(+,*)*+-2C?????????????????6????????????????????????????????????????????SE(&%%%$$$$$$############"
!##$$$$$$$$$$$$%%%%%%%%&&''')*+-19?????????????U..Y?????????????????????????????????????????????<)&%%$$$$$#############"
!"####$$$$$$$$$$$$%%%%%%%&&''()+/@NM073U?42D.5+*++.U???????????????????????????????????????????6)(&&%$$$$$############""
!!########$$$$$$$$$$$%%%%%&&(*/*)**))*9-*))((((())+G????????????????????????????????????????????r5(&%$$$$#############""
!!"###############$$$$$$$%%&',,''&&&&&&''''''''''((*,w`??????????????????????????????????????>+)),&%%$$$#############"""
!!!"#####################$$$$%%%%%%%%%%%%%%%&&&&&&')-11.Y??????????????????????????????????5.+)''&%%%$$$############""""
!!!!""########################$$$$$%%%%%%%%%%%%&&&&&'((),3??????????????????????????????6????2+)&&%%$$$###########""""""
!!!!"""###########################$$$$$$$$%%%%%%%%&&&''544€;C0-2=??????????????????¯??-**+;6+-.+)%%$$############"""""""
!!!!!""""############################$$$$$$$$$$$%%%%%&(8*+,.)())20++,-0<??????6.,+*)*-('''''')+&%$$$###########"""""""""
!!!!!!"""""#############################$$$$$$$$$$$$$$%%%&&&&&&'''((*0?????????8,((''&&&&%%%%%%$$$$##########"""""""""""
!!!!!!!""""""###############################$$$$$$$$$$$$$$%%%%&&&&'(*,=É??????D3B+'&%%%%%%%$$$$$$##########"""""""""""""
!!!!!!!!!"""""""###############################$$$$$$$$$$$$$$%%%%%%&'(+*+1<?80*((&&%%%%$$$$$$$$#########""""""""""""""""
!!!!!!!!!!""""""""################################$$$$$$$$$$$$$%%%%%%&''()+0.*)'&&%%$$$$$$$$$#########""""""""""""""""""
!!!!!!!!!!!!""""""""""################################$$$$$$$$$$$%%%%&&'+7-(''()&%$$$$$$$$########""""""""""""""""""""""
!!!!!!!!!!!!!"""""""""""""#################################$$$$$$$$$%%&'0)&%%%%$$$$$$$########""""""""""""""""""""""""""
!!!!!!!!!!!!!!!""""""""""""""""###################################$$$$$$$$$$$$$$#########"""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!""""""""""""""""""""##############################################"""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!"""""""""""""""""""""""""""""########################""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!!!!!!!!!!!!!!!!!!!!!!!!!!!"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The flags I used to compile the C iteration loop are /Ot /O2 /GD /G6 /Og (means as much time optimizations as possible).

Content

Iterate.c
IterateJava.java
IterateJNI.java
Make.bat
Mandel.zip
MandelBenchmark.java