The Computer Language
24.06 Benchmarks Game

n-body

First a few simple programs.

Then optimisations, multicore parallelism, [pdf] vector parallelism.

Last hand-written vector instructions and "unsafe" programs.

  source secs mem gz    
  Chapel #3 3.89 19,672 967    
  C clang 5.51 19,716 1179    
  Java 7.89 41,616 1437    
 
 
 
× source secs mem gz cpu secs cpu load
1.0 Chapel #3 3.89 19,672 967 3.90 100% 0% 0% 0%
1.0 Rust #2 3.94 19,700 1809 3.94 0% 0% 99% 0%
1.1 Julia #8 4.17 275,408 1129 4.26 2% 96% 0% 3%
1.1 Classic Fortran #6 4.22 19,644 1530 4.22 0% 0% 100% 1%
1.1 Rust #6 4.32 19,716 1796 4.32 0% 100% 0% 0%
1.2 Rust #8 4.49 19,684 1774 4.49 100% 0% 1% 0%
1.2 Chapel #4 4.58 19,656 1027 4.59 100% 0% 0% 0%
1.3 C gcc #6 4.97 19,684 1186 4.97 100% 0% 0% 0%
1.3 Rust #4 5.18 19,716 1810 5.18 100% 0% 0% 0%
1.3 C gcc 5.18 19,684 1179 5.18 0% 0% 100% 0%
1.3 C gcc #2 5.20 19,684 1270 5.20 0% 0% 100% 0%
1.3 C gcc #3 5.24 19,684 1214 5.24 100% 0% 0% 0%
1.4 C++ g++ #3 5.31 19,736 1402 5.31 100% 0% 0% 0%
1.4 Classic Fortran #2 5.38 19,644 1507 5.38 100% 0% 0% 0%
1.4 Classic Fortran 5.44 19,644 1400 5.44 100% 1% 0% 0%
1.4 C++ g++ #9 5.44 19,736 1536 5.44 0% 100% 0% 0%
1.4 Rust 5.51 19,716 1483 5.51 0% 0% 0% 100%
1.4 Rust #3 5.56 19,716 1546 5.56 0% 0% 100% 0%
1.4 Chapel #2 5.64 19,672 977 5.65 100% 1% 0% 0%
1.5 Julia #4 5.75 254,720 1168 5.84 1% 2% 97% 0%
1.5 Ada 2012 GNAT #3 5.76 19,760 1758 5.76 0% 0% 0% 100%
1.5 Ada 2012 GNAT 5.86 19,760 1624 5.86 1% 0% 0% 100%
1.5 Swift #6 5.99 19,700 1200 5.99 100% 0% 0% 0%
1.5 C++ g++ #5 6.02 19,736 1544 6.01 100% 0% 0% 0%
1.6 Classic Fortran #5 6.05 19,908 1669 6.04 0% 100% 0% 1%
1.6 Classic Fortran #4 6.18 19,652 1183 6.18 0% 1% 100% 0%
1.6 Free Pascal 6.29 19,672 1331 6.29 0% 0% 100% 0%
1.6 Free Pascal #2 6.29 19,672 1345 6.29 0% 0% 0% 100%
1.6 Classic Fortran #3 6.33 19,900 1311 6.33 0% 0% 100% 0%
1.6 Go #3 6.38 19,688 1207 6.39 100% 0% 0% 0%
1.7 C++ g++ 6.50 19,736 1666 6.50 0% 100% 0% 0%
1.7 C++ g++ #8 6.54 19,736 1524 6.54 0% 0% 99% 0%
1.7 Julia #3 6.55 257,536 1548 6.64 0% 99% 2% 0%
1.7 C# .NET #3 6.65 31,492 1311 6.64 99% 0% 0% 0%
1.7 Java  #5 6.79 41,476 1435 6.83 99% 1% 0% 0%
1.8 C gcc #7 6.82 19,684 1250 6.82 84% 0% 0% 16%
1.8 C# .NET #8 6.83 31,528 1339 6.82 0% 0% 0% 99%
1.8 C# .NET #2 6.83 31,524 1350 6.82 0% 0% 1% 99%
1.8 OCaml 6.84 19,672 1255 6.84 0% 0% 0% 100%
1.8 F# .NET #4 6.89 33,992 1296 6.88 99% 0% 0% 0%
1.8 Java #4 6.91 41,364 1495 6.95 1% 0% 0% 99%
1.8 C++ g++ #6 6.91 19,736 1674 6.91 0% 100% 0% 1%
1.8 F# .NET #3 6.92 32,372 1624 6.91 0% 0% 99% 0%
1.8 Dart #6 6.96 19,664 1318 6.96 99% 0% 0% 0%
1.8 Go 7.00 19,688 1316 7.02 0% 0% 0% 100%
1.8 Go #2 7.03 19,688 1222 7.04 0% 0% 100% 0%
1.8 Free Pascal #3 7.18 19,672 1441 7.18 100% 0% 0% 0%
1.9 F# .NET #2 7.42 34,040 1387 7.41 99% 0% 0% 0%
1.9 Java #2 7.58 41,440 1430 7.62 99% 0% 0% 0%
2.0 Java #3 7.63 41,352 1436 7.67 0% 89% 11% 0%
2.0 F# .NET 7.77 49,464 1272 7.83 0% 0% 0% 99%
2.0 C# .NET 7.80 31,508 1424 7.79 99% 0% 0% 0%
2.0 Lisp SBCL #2 7.83 23,040 1408 7.83 100% 0% 0% 0%
2.0 Java 7.89 41,616 1437 7.93 0% 0% 99% 0%
2.1 Swift #3 8.12 19,688 1210 8.12 100% 0% 0% 0%
2.2 Node.js #6 8.62 51,184 1274 8.62 0% 1% 0% 100%
2.3 Dart #2 9.04 19,660 1273 9.04 0% 0% 0% 99%
2.4 Lisp SBCL 9.25 23,168 1373 9.25 100% 0% 0% 0%
2.4 Swift #2 9.54 19,684 1198 9.54 0% 100% 0% 0%
2.8 Haskell GHC #2 11.10 19,688 1888 11.26 0% 0% 0% 100%
2.9 Dart #3 11.15 19,660 1413 11.15 0% 0% 100% 0%
6.1 Julia #2 23.88 303,148 1084 24.01 0% 100% 0% 0%
10 Racket 40.56 79,516 1503 40.55 100% 0% 0% 0%
17 PHP #3 67.03 19,656 1088 67.03 0% 0% 0% 100%
27 Erlang #3 104.40 55,560 1405 104.46 0% 0% 0% 99%
28 VW Smalltalk 108.66 55,424 1787 108.65 0% 0% 100% 0%
49 Ruby yjit #3 189.13 21,120 1169 189.12 0% 0% 100% 0%
55 Ruby yjit #2 215.86 21,120 1143 215.85 100% 0% 0% 0%
57 Lua #2 220.08 19,656 1200 220.07 0% 0% 0% 100%
57 Lua #4 223.32 19,656 1312 223.30 100% 0% 0% 0%
67 Lua 262.10 19,656 1207 262.08 100% 0% 0% 0%
74 Swift #9 287.21 19,688 1532 287.20 100% 0% 0% 0%
91 Python 3 5 min 19,652 1201 5 min 96% 0% 0% 3%
93 Python 3 #2 6 min 19,652 1247 6 min 0% 100% 0% 0%
114 Perl #2 7 min 19,688 1431 7 min 97% 0% 2% 0%
670 Matz's Ruby #2 43 min 19,860 1143 43 min 100% 0% 0% 0%
678 Matz's Ruby #3 43 min 19,684 1169 43 min 0% 0% 100% 0%
 
 
  hand-written vector instructions | "unsafe"
 
× source secs mem gz cpu secs cpu load
0.5 C gcc #9 2.10 19,704 1639 2.10 0% 0% 100% 1%
0.6 C++ g++ #0 2.15 19,736 1933 2.15 100% 0% 0% 0%
0.6 Rust #9 2.16 19,716 1881 2.16 100% 0% 0% 0%
0.8 C# .NET #9 3.16 30,388 2480 3.16 0% 99% 0% 0%
0.8 Rust #7 3.24 19,700 1759 3.24 0% 0% 0% 100%
0.9 C gcc #8 3.70 19,684 1398 3.69 100% 0% 0% 1%
1.0 C# .NET #4 3.75 30,516 2137 3.74 0% 0% 0% 99%
1.0 C++ g++ #7 3.96 19,736 1815 3.96 0% 0% 100% 1%
1.1 C++ g++ #2 4.20 19,736 1884 4.20 100% 1% 0% 0%
1.1 C gcc #4 4.31 19,684 1496 4.31 100% 0% 0% 0%
1.2 C# .NET #7 4.79 30,640 1715 4.79 0% 99% 0% 0%
1.2 C# .NET #6 4.82 30,640 1754 4.81 0% 99% 1% 0%
1.3 F# .NET #6 4.97 33,856 1395 4.96 0% 0% 99% 0%
1.3 Rust #5 5.02 19,716 2224 5.02 0% 0% 0% 100%
1.4 C gcc #5 5.43 19,684 1436 5.43 100% 0% 0% 0%
1.4 C++ g++ #4 5.45 19,736 1434 5.45 0% 26% 0% 73%
1.4 Swift #4 5.49 19,688 1361 5.49 0% 0% 100% 0%
1.4 Swift #5 5.52 19,688 1372 5.52 0% 100% 0% 0%
1.4 Swift #7 5.54 19,700 1333 5.54 0% 100% 0% 0%
1.5 F# .NET #5 5.74 33,780 1363 5.73 99% 1% 0% 0%
1.5 Ada 2012 GNAT #2 5.77 19,764 2623 5.77 0% 0% 0% 100%
1.5 Swift #8 6.00 19,684 1688 5.99 100% 0% 0% 0%
2.3 Ada 2012 GNAT #5 9.06 19,764 2452 9.05 40% 0% 59% 0%
3.7 Racket #2 14.25 77,216 1695 14.25 0% 0% 0% 100%
3.8 Haskell GHC 14.81 19,688 1713 15.03 0% 0% 0% 100%