The Computer Language
Benchmarks Game

n-body

Always look at the source code.

Look at the slower simple sequential programs, and  look at the parallel programs written for multicore, and  look at the manually vectorized SIMD programs.

× source secs mem gz busy cpu load
1.0 C++ g++ 2.12 764 1927 2.17 0% 2% 100% 0%
1.0 C gcc #9 2.18 768 1633 2.19 0% 100% 0% 0%
1.6 Rust #7 3.29 1,196 1753 3.33 0% 100% 1% 0%
1.8 C# .NET #9 3.84 32,788 2125 4.09 1% 4% 99% 2%
1.9 Julia #8 4.05 218,740 1111 4.36 3% 2% 3% 100%
1.9 C++ g++ #7 4.10 1,724 1808 4.16 100% 1% 1% 0%
1.9 C++ g++ #2 4.12 1,776 1879 4.17 0% 100% 1% 0%
2.0 Intel Fortran #6 4.22 12 1524 4.34 100% 1% 1% 2%
2.1 C gcc #8 4.35 8 1391 4.38 100% 1% 0% 0%
2.1 C gcc #4 4.41 1,080 1490 4.43 0% 0% 0% 100%
2.1 Rust #6 4.52 1,188 1790 4.56 0% 100% 0% 0%
2.3 C# .NET #7 4.83 32,756 1704 4.85 0% 0% 0% 100%
2.3 C# .NET #6 4.86 32,892 1742 5.10 4% 0% 1% 100%
2.4 F# .NET #6 5.07 35,072 1383 5.18 1% 99% 1% 1%
2.4 Ada 2012 GNAT #2 5.13 1,984 2617 5.15 0% 0% 100% 0%
2.5 Swift #5 5.32 10,456 1365 5.37 100% 0% 0% 0%
2.5 Swift #7 5.33 10,468 1326 5.36 100% 0% 0% 0%
2.5 Intel Fortran #2 5.38 12 1500 5.61 1% 1% 2% 100%
2.5 Swift #4 5.40 10,412 1355 5.45 0% 0% 100% 1%
2.6 Intel Fortran 5.42 12 1393 5.63 100% 0% 1% 2%
2.7 Rust #3 5.68 1,196 1540 5.70 0% 100% 0% 0%
2.7 C++ g++ #4 5.70 768 1428 5.72 0% 0% 0% 100%
2.7 C++ g++ #6 5.71 1,084 1668 5.75 100% 0% 0% 0%
2.7 Swift #8 5.72 10,480 1681 5.74 0% 100% 0% 0%
2.7 Rust 5.81 1,184 1480 5.96 2% 100% 0% 0%
2.8 Julia #4 5.97 210,680 1155 6.26 2% 98% 4% 2%
2.8 Rust #8 5.97 1,196 1767 6.20 2% 0% 100% 2%
2.8 Intel Fortran #5 5.97 12 1664 6.22 2% 100% 0% 2%
2.9 C++ g++ #9 6.04 1,028 2056 6.06 0% 0% 100% 0%
2.9 C++ g++ 6.05 1,084 1659 6.09 0% 0% 0% 100%
2.9 Swift #6 6.09 7,400 1194 6.11 0% 0% 0% 100%
2.9 Rust #5 6.10 1,196 2220 6.43 4% 100% 0% 2%
2.9 C gcc #5 6.11 768 1429 6.12 0% 100% 0% 0%
2.9 Rust #2 6.14 1,196 1805 6.15 0% 0% 0% 100%
2.9 C++ g++ #5 6.16 1,780 1749 6.20 0% 100% 0% 0%
2.9 Intel Fortran #4 6.18 12 1179 6.38 1% 2% 100% 1%
3.0 Free Pascal #2 6.28 8 1339 6.33 100% 0% 0% 0%
3.0 Free Pascal 6.28 8 1325 6.29 0% 100% 0% 0%
3.0 Rust #4 6.30 1,196 1803 6.55 3% 1% 100% 0%
3.0 Intel Fortran #3 6.32 12 1305 6.54 0% 1% 2% 100%
3.0 C++ g++ #3 6.35 1,028 1396 6.37 0% 0% 0% 100%
3.0 Go #3 6.38 1,604 1200 6.42 0% 100% 0% 0%
3.0 C gcc #7 6.38 1,088 1244 6.40 0% 100% 0% 0%
3.0 Haskell GHC #2 6.42 4,176 1883 6.47 0% 0% 0% 100%
3.1 C gcc #6 6.47 1,084 1180 6.61 1% 1% 0% 100%
3.1 F# .NET #5 6.53 35,100 1351 6.82 3% 100% 2% 0%
3.1 Ada 2012 GNAT #3 6.54 1,988 1750 6.56 0% 100% 0% 0%
3.1 Go 6.58 1,132 1310 6.81 1% 100% 2% 1%
3.1 C gcc #2 6.64 1,084 1263 6.66 0% 0% 0% 100%
3.2 OCaml 6.70 1,468 1251 6.70 100% 0% 0% 0%
3.2 Java  #4 6.77 35,432 1489 6.82 100% 1% 0% 0%
3.2 Chapel #2 6.84 5,376 971 7.03 100% 1% 1% 1%
3.2 C gcc 6.87 1,028 1173 6.94 1% 0% 100% 0%
3.2 F# .NET #3 6.88 34,744 1617 6.92 0% 100% 1% 0%
3.3 C# .NET #3 6.93 32,888 1305 6.97 100% 0% 0% 0%
3.3 Go #2 6.94 1,100 1215 6.97 0% 0% 0% 100%
3.3 Java #5 7.03 35,608 1429 7.07 0% 0% 100% 0%
3.3 C++ g++ #8 7.03 1,028 1517 7.05 100% 0% 0% 0%
3.3 F# .NET #4 7.04 29,788 1290 7.12 100% 1% 1% 0%
3.3 C# .NET #2 7.07 32,732 1343 7.09 100% 0% 0% 0%
3.4 Free Pascal #3 7.16 8 1435 7.19 0% 0% 0% 100%
3.4 Haskell GHC 7.16 4,024 1706 7.18 100% 0% 0% 0%
3.4 Julia #3 7.19 216,480 1541 7.51 1% 100% 2% 2%
3.4 C gcc #3 7.20 1,080 1208 7.26 1% 0% 0% 100%
3.4 Dart #6 7.30 10,352 1311 7.89 100% 0% 4% 4%
3.5 Ada 2012 GNAT 7.31 1,976 1618 7.35 92% 0% 0% 9%
3.5 F# .NET #2 7.35 34,992 1381 7.64 0% 1% 100% 3%
3.5 Java #3 7.45 35,688 1430 7.55 1% 100% 0% 0%
3.5 Java #2 7.47 35,956 1424 7.55 0% 1% 0% 100%
3.7 Java 7.82 38,120 1430 7.90 0% 0% 0% 100%
3.7 Lisp SBCL #2 7.83 17,892 1403 7.88 0% 0% 100% 0%
4.1 Node js #6 8.60 36,000 1268 8.85 100% 2% 0% 1%
4.1 Ada 2012 GNAT #5 8.78 1,988 2447 8.99 100% 0% 0% 1%
4.3 Swift #2 9.14 7,408 1192 9.18 0% 0% 0% 100%
4.8 Dart #2 10.07 10,432 1266 10.26 100% 0% 0% 1%
5.6 Dart #3 11.93 10,460 1407 11.95 0% 0% 100% 0%
6.2 Lisp SBCL 13.15 17,900 1368 13.23 0% 100% 0% 0%
6.8 Racket #2 14.32 70,160 1689 14.37 0% 0% 100% 0%
10 Julia #2 21.78 291,204 1078 22.74 1% 100% 2% 1%
19 Racket 39.91 69,968 1496 40.28 0% 0% 100% 0%
34 PHP #3 71.75 12,072 1082 76.86 3% 1% 2% 100%
47 Erlang #3 100.57 37,616 1399 101.23 0% 100% 0% 0%
51 VW Smalltalk 108.63 55,036 1782 109.07 0% 0% 100% 0%
89 Ruby #3 188.10 23,088 1163 191.79 0% 1% 1% 100%
90 Swift #3 190.13 7,476 1204 191.25 100% 0% 0% 0%
98 Lua #4 208.01 1,240 1305 208.83 0% 0% 100% 0%
101 Lua #2 214.72 1,240 1193 220.90 1% 1% 1% 100%
106 Lua 224.00 1,236 1201 225.15 100% 0% 0% 0%
110 Ruby #2 232.08 22,968 1137 236.00 0% 1% 100% 0%
137 Swift #9 290.87 10,480 1526 292.65 0% 0% 0% 100%
198 Perl #2 6 min 6,388 1429 7 min 1% 1% 1% 100%
268 Python 3 9 min 8,076 1196 9 min 0% 0% 0% 100%
282 Python 3 #2 9 min 8,232 1242 10 min 0% 0% 0% 100%
  Matz's Ruby #2 38 min 3,816 1137 38 min 0% 0% 0% 100%
  Matz's Ruby #3 38 min 3,800 1163 39 min 1% 97% 0% 3%
F# .NET Bad Output