Created
March 30, 2009 11:16
-
-
Save hipertracker/87746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java & Scala vs C++ benchmark | |
Machine: PowerMac 2x2.8 GHz Xeon (8 cores), 4GB RAM | |
$ g++ -v | |
Using built-in specs. | |
Target: i686-apple-darwin9 | |
Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9 | |
Thread model: posix | |
gcc version 4.0.1 (Apple Inc. build 5493) | |
$ java -version | |
java version "1.6.0_07" | |
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) | |
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode) | |
$ scala -version | |
Scala code runner version 2.7.3.final -- Copyright 2002-2009, LAMP/EPFL | |
SOURCE code for C++: http://gist.github.com/87516 | |
SOURCE code for Java: http://gist.github.com/87518 | |
SOURCE code for Scala: http://gist.github.com/87760 | |
RESULTS: | |
C++ | |
$ g++ -O3 -fomit-frame-pointer -march=pentium4 Bench.cpp -o Bench | |
$ ./Bench | |
1796.2 | |
1682.14 | |
1673.19 | |
1678.66 | |
1685.71 | |
1671.59 | |
1702.79 | |
1714.34 | |
1652.46 | |
1651.8 | |
JAVA | |
$ javac Bench.java | |
java -server Bench | |
967 | |
1036 | |
769 | |
740 | |
716 | |
718 | |
717 | |
716 | |
716 | |
717 | |
SCALA | |
$ java -server -cp /opt/local/share/java/scala-library.jar:. BenchScala | |
1016 | |
951 | |
716 | |
717 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment