The Computer Language
22.05 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 5.54 5,496 960    
  C clang 5.96 1,252 1173    
  Java 7.80 37,380 1430    
 
 
 
× source secs mem gz cpu cpu load
1.0 Rust #6 4.05 1,028 1790 4.05 0% 0% 100% 0%
1.0 Classic Fortran #6 4.22 628 1524 4.22 1% 0% 100% 0%
1.0 Julia #8 4.24 225,844 1111 4.49 41% 61% 2% 3%
1.2 C++ g++ #9 4.90 1,260 1530 4.90 100% 1% 0% 1%
1.3 Classic Fortran #2 5.37 612 1500 5.37 0% 0% 100% 0%
1.4 Classic Fortran 5.49 1,344 1393 5.49 0% 0% 0% 100%
1.4 Rust #3 5.49 1,108 1540 5.49 100% 1% 0% 0%
1.4 Chapel #3 5.54 5,496 960 5.53 100% 1% 0% 0%
1.4 C++ g++ #6 5.65 1,300 1668 5.65 1% 0% 100% 0%
1.4 Rust #2 5.68 1,032 1805 5.67 100% 1% 0% 0%
1.4 Julia #4 5.68 202,592 1155 5.95 2% 2% 100% 2%
1.4 Rust 5.68 1,044 1480 5.68 0% 1% 0% 100%
1.4 C++ g++ #3 5.74 1,280 1396 5.74 1% 100% 0% 0%
1.4 Rust #8 5.78 1,104 1767 5.78 100% 0% 0% 0%
1.5 Ada 2012 GNAT 5.91 2,544 1618 5.91 0% 100% 1% 0%
1.5 C++ g++ 5.93 1,260 1659 5.93 0% 1% 100% 1%
1.5 Ada 2012 GNAT #3 5.97 2,560 1750 5.97 100% 1% 0% 0%
1.5 C++ g++ #8 6.09 1,220 1517 6.08 100% 0% 0% 0%
1.5 Swift #6 6.11 6,356 1194 6.11 0% 0% 100% 0%
1.5 Classic Fortran #4 6.18 1,344 1179 6.18 100% 0% 0% 0%
1.5 Classic Fortran #5 6.19 1,344 1664 6.19 0% 0% 0% 100%
1.5 Chapel #2 6.21 5,516 971 7.16 100% 3% 10% 2%
1.5 Rust #4 6.25 1,088 1803 6.25 100% 0% 0% 0%
1.6 Free Pascal #2 6.28 8 1322 6.28 0% 0% 100% 0%
1.6 Free Pascal 6.28 8 1308 6.28 0% 100% 0% 0%
1.6 Classic Fortran #3 6.32 1,344 1305 6.31 0% 0% 100% 0%
1.6 Go #3 6.37 1,136 1200 6.38 0% 100% 1% 0%
1.6 Haskell GHC #2 6.53 6,140 1883 6.61 3% 1% 100% 0%
1.6 Go 6.58 1,136 1310 6.58 0% 0% 100% 0%
1.7 Java  #4 6.77 34,076 1489 6.79 1% 2% 100% 1%
1.7 Julia #3 6.78 207,868 1541 7.05 100% 2% 1% 1%
1.7 Java #5 6.78 34,252 1429 6.79 100% 0% 0% 0%
1.7 C gcc #7 6.79 1,300 1244 6.79 100% 0% 0% 0%
1.7 F# .NET #3 6.86 35,620 1617 6.84 100% 0% 0% 0%
1.7 OCaml 6.91 1,748 1251 6.91 0% 100% 0% 0%
1.7 F# .NET #4 6.92 34,136 1290 6.91 100% 0% 0% 0%
1.7 C# .NET #3 6.92 34,000 1305 6.90 1% 100% 0% 0%
1.7 Go #2 6.93 1,132 1215 6.94 1% 0% 100% 0%
1.7 C# .NET #2 7.04 33,984 1343 7.03 3% 0% 2% 100%
1.7 C# .NET #8 7.05 33,996 1332 7.03 0% 0% 100% 0%
1.7 Dart #6 7.07 9,996 1311 7.07 100% 0% 0% 0%
1.8 Free Pascal #3 7.16 8 1418 7.16 0% 100% 0% 0%
1.8 C gcc #2 7.19 1,264 1263 7.19 0% 100% 0% 0%
1.8 C gcc #6 7.21 1,304 1180 7.21 0% 0% 100% 0%
1.8 C gcc #3 7.23 1,304 1208 7.23 0% 0% 100% 0%
1.8 F# .NET #2 7.24 37,376 1381 7.22 0% 100% 0% 0%
1.8 Java #3 7.47 34,612 1430 7.50 0% 100% 0% 1%
1.8 Java #2 7.49 34,704 1424 7.50 100% 0% 3% 1%
1.9 C gcc 7.55 1,264 1173 7.55 1% 0% 100% 0%
1.9 Java 7.80 37,380 1430 7.83 1% 100% 0% 1%
1.9 Lisp SBCL #2 7.85 26,588 1403 7.85 0% 0% 0% 100%
2.0 Swift #3 8.12 6,452 1204 8.11 0% 100% 0% 0%
2.1 Node js #6 8.43 41,056 1268 8.43 0% 0% 0% 100%
2.1 Swift #2 8.68 6,420 1192 8.68 0% 1% 100% 0%
2.3 Dart #2 9.45 10,280 1266 9.45 0% 0% 100% 0%
2.9 Dart #3 11.70 10,176 1407 11.70 0% 100% 0% 0%
3.3 Lisp SBCL 13.19 26,624 1368 13.19 100% 0% 1% 0%
6.0 Julia #2 24.22 268,512 1078 24.49 1% 0% 1% 100%
10 Racket 40.84 68,936 1496 40.83 100% 0% 0% 1%
16 PHP #3 66.40 12,372 1082 66.39 0% 0% 100% 0%
25 Erlang #3 102.82 38,252 1399 102.87 0% 0% 100% 0%
27 VW Smalltalk 110.91 55,180 1782 110.90 100% 0% 0% 0%
54 Ruby #3 219.69 285,504 1163 219.69 2% 1% 100% 2%
55 Ruby #2 224.67 285,552 1137 224.66 0% 0% 0% 100%
56 Lua #4 228.34 1,404 1305 228.33 0% 0% 0% 100%
57 Lua #2 231.52 1,476 1193 231.51 0% 0% 100% 0%
62 Lua 249.57 1,416 1201 249.47 0% 100% 0% 0%
72 Swift #9 292.57 14,032 1526 292.55 100% 0% 0% 0%
122 Perl #2 8 min 6,280 1429 8 min 100% 0% 0% 0%
142 Python 3 9 min 7,756 1196 9 min 1% 100% 1% 1%
146 Python 3 #2 9 min 8,244 1242 9 min 0% 100% 0% 0%
563 Matz's Ruby #2 38 min 3,816 1137 37 min 0% 0% 0% 100%
576 Matz's Ruby #3 38 min 3,800 1163 38 min 1% 97% 0% 3%
F# .NET Bad Output
 
 
  hand-written vector instructions | "unsafe"
 
× source secs mem gz cpu cpu load
0.5 C gcc #9 2.12 992 1633 2.12 0% 0% 100% 0%
0.5 C++ g++ #0 2.17 964 1927 2.17 3% 100% 0% 0%
0.7 Rust #9 2.89 1,052 1874 2.89 0% 1% 100% 0%
0.8 C# .NET #9 3.18 33,528 2467 3.17 99% 0% 0% 1%
0.8 Rust #7 3.24 1,052 1753 3.24 0% 100% 0% 0%
0.9 C# .NET #4 3.84 33,456 2125 3.83 5% 1% 1% 99%
1.0 C++ g++ #2 4.06 1,944 1879 4.06 0% 0% 0% 100%
1.0 C gcc #8 4.10 8 1391 4.10 100% 0% 0% 0%
1.1 C++ g++ #7 4.28 1,976 1808 4.28 100% 0% 0% 0%
1.1 C gcc #4 4.44 1,304 1490 4.44 3% 100% 1% 0%
1.2 C# .NET #7 4.81 33,644 1704 4.78 0% 99% 0% 0%
1.2 C# .NET #6 4.82 33,932 1742 4.80 0% 0% 0% 99%
1.2 F# .NET #6 5.00 37,180 1383 4.99 100% 0% 1% 0%
1.3 Swift #4 5.28 14,076 1355 5.28 1% 0% 100% 0%
1.3 Swift #5 5.29 10,800 1365 5.29 1% 0% 0% 100%
1.3 Swift #7 5.33 14,024 1326 5.33 0% 0% 100% 0%
1.4 C++ g++ #4 5.68 1,040 1428 5.68 0% 100% 0% 0%
1.4 Swift #8 5.70 14,028 1681 5.70 2% 2% 7% 100%
1.4 Ada 2012 GNAT #2 5.72 2,540 2617 5.72 1% 0% 100% 0%
1.5 C gcc #5 6.10 1,020 1429 6.10 0% 100% 0% 0%
1.5 Rust #5 6.11 1,104 2220 6.10 0% 0% 100% 0%
1.5 C++ g++ #5 6.11 1,944 1749 6.11 0% 0% 100% 0%
1.6 F# .NET #5 6.33 37,244 1351 6.31 0% 0% 100% 0%
1.8 Haskell GHC 7.19 6,136 1706 7.28 1% 1% 1% 100%
2.2 Ada 2012 GNAT #5 8.92 2,588 2447 8.92 0% 0% 100% 2%
3.5 Racket #2 14.09 68,496 1689 14.09 0% 0% 0% 100%