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 low-level programs written for SIMD.

× source secs mem gz busy cpu load
1.0 Rust #7 5.98 936 1753 6.10 1% 0% 69% 32%
1.2 C gcc #8 7.30 8 1391 7.33 0% 0% 1% 100%
1.3 C++ g++ #2 7.70 1,772 1879 8.02 4% 0% 0% 100%
1.3 C++ g++ #9 7.92 1,072 1773 8.13 1% 1% 100% 0%
1.3 C++ g++ #8 8.05 1,092 1765 8.16 0% 1% 100% 0%
1.3 C++ g++ #3 8.06 1,764 1763 8.13 0% 0% 0% 100%
1.3 C++ g++ #7 8.07 1,756 1808 8.16 0% 100% 1% 0%
1.4 Intel Fortran #6 8.20 8 1524 8.31 0% 1% 1% 100%
1.5 C gcc #4 8.73 1,104 1490 9.25 2% 100% 4% 0%
1.5 Intel Fortran #5 9.00 8 1664 9.18 2% 0% 0% 100%
1.6 Ada 2012 GNAT #2 9.51 1,972 2617 9.56 0% 0% 0% 100%
1.7 Julia #6 10.01 215,168 1430 10.41 100% 2% 1% 1%
2.2 Rust 13.00 876 1480 13.17 100% 0% 0% 1%
2.2 Rust #2 13.24 876 1805 13.34 0% 0% 100% 1%
2.2 C++ g++ #5 13.29 1,804 1749 13.69 2% 1% 0% 100%
2.2 Rust #8 13.40 936 1767 13.53 100% 1% 0% 0%
2.6 Ada 2012 GNAT #5 15.63 1,972 2447 15.84 0% 1% 1% 100%
3.1 Rust #4 18.48 936 1803 18.72 81% 20% 0% 1%
3.3 Intel Fortran 19.66 8 1393 19.94 1% 0% 0% 100%
3.3 Intel Fortran #2 19.68 8 1500 19.94 0% 1% 1% 100%
3.3 C++ g++ 19.71 1,072 1659 19.95 0% 1% 100% 0%
3.3 C++ g++ #6 19.75 1,076 1668 19.86 100% 0% 0% 0%
3.4 Rust #5 20.08 876 2220 20.49 51% 49% 1% 1%
3.4 Rust #3 20.30 876 1540 20.45 100% 0% 0% 0%
3.4 Rust #6 20.35 876 1790 20.59 0% 0% 100% 1%
3.5 C gcc #3 21.13 1,108 1208 21.33 0% 100% 1% 0%
3.6 Go 21.26 1,884 1310 21.41 38% 62% 0% 0%
3.6 OCaml 21.67 1,484 1251 22.30 0% 1% 100% 2%
3.6 C# .NET Core #3 21.75 34,648 1305 22.06 0% 41% 59% 1%
3.6 Intel Fortran #4 21.75 8 1179 21.93 0% 1% 100% 0%
3.7 Chapel 21.85 5,516 962 22.13 100% 1% 0% 0%
3.7 Haskell GHC #2 21.87 4,364 1883 86.49 99% 100% 99% 98%
3.7 Swift #4 22.03 12,272 1355 22.34 47% 0% 0% 54%
3.7 C# .NET Core #8 22.05 34,452 1343 22.33 0% 32% 69% 0%
3.7 F# .NET Core #4 22.20 35,072 1290 22.55 1% 0% 100% 1%
3.7 Intel Fortran #3 22.25 8 1305 22.56 1% 0% 0% 100%
3.7 Free Pascal 22.36 8 1325 22.46 0% 100% 0% 0%
3.8 Java  #5 22.67 34,892 1429 23.01 1% 0% 0% 100%
3.8 F# .NET Core #2 22.68 37,556 1381 22.83 98% 0% 1% 2%
3.8 Java #3 22.75 34,664 1430 23.02 1% 0% 100% 0%
3.8 Free Pascal #2 22.75 8 1339 22.85 100% 0% 0% 0%
3.8 C gcc #7 23.01 1,104 1244 24.12 4% 1% 0% 100%
3.9 Java #2 23.05 34,616 1424 23.82 2% 1% 100% 1%
3.9 Node js #6 23.25 35,092 1268 23.48 0% 0% 1% 100%
3.9 Java 23.43 36,428 1430 24.01 2% 0% 0% 100%
3.9 Julia #3 23.52 191,516 1541 24.01 11% 1% 89% 1%
3.9 Julia #4 23.52 185,140 1155 24.29 100% 2% 1% 1%
4.0 C++ g++ #4 23.67 780 1428 24.09 0% 1% 1% 100%
4.0 C gcc #5 23.83 844 1429 23.94 0% 0% 0% 100%
4.0 Haskell GHC 23.83 4,224 1706 94.35 99% 100% 99% 99%
4.0 Ada 2012 GNAT #3 23.84 2,040 1750 24.13 100% 0% 0% 1%
4.0 C gcc 24.14 1,100 1173 24.43 0% 1% 100% 0%
4.0 F# .NET Core #3 24.22 36,992 1617 24.68 32% 0% 1% 69%
4.1 C gcc #6 24.30 1,104 1180 24.59 0% 1% 100% 0%
4.1 Swift #6 24.33 6,772 1194 24.65 1% 0% 0% 100%
4.1 Java #4 24.64 34,420 1489 24.87 0% 100% 0% 0%
4.2 Free Pascal #3 24.93 8 1435 25.25 0% 1% 1% 100%
4.3 C gcc #2 25.43 1,104 1263 25.59 100% 0% 1% 0%
4.3 Go #3 25.67 1,880 1200 25.92 100% 0% 0% 1%
4.3 Swift #8 25.88 12,136 1681 26.14 0% 0% 100% 1%
4.4 Lisp SBCL #2 26.25 18,060 1403 26.61 1% 0% 100% 1%
4.5 Go #2 26.75 1,880 1215 26.95 1% 100% 0% 0%
4.6 Dart #3 27.69 114,464 1409 28.19 1% 1% 99% 1%
4.7 Ada 2012 GNAT 28.28 2,040 1618 28.51 0% 1% 0% 100%
5.0 Swift #3 29.88 6,784 1204 30.26 0% 1% 100% 0%
5.5 Dart #2 32.87 109,700 1264 34.04 99% 2% 2% 1%
5.8 Swift #2 34.85 6,788 1192 35.48 0% 0% 100% 1%
7.0 Lisp SBCL 41.81 18,012 1368 42.17 1% 0% 100% 0%
8.0 Julia #2 47.90 241,848 1078 49.02 1% 93% 7% 1%
9.0 Racket #2 53.65 38,064 1689 54.22 48% 39% 0% 14%
15 Racket 88.68 39,340 1496 89.90 0% 100% 0% 1%
32 Erlang HiPE #3 194.05 24,108 1399 196.23 100% 0% 0% 1%
33 VW Smalltalk 196.18 55,120 1782 198.51 0% 100% 0% 1%
52 PHP #3 5 min 8,040 1082 5 min 65% 16% 5% 16%
63 Ruby #2 6 min 25,668 1137 6 min 67% 20% 2% 14%
68 Lua #4 6 min 1,368 1305 6 min 0% 0% 1% 100%
72 Swift #9 7 min 12,072 1526 7 min 0% 65% 35% 1%
74 Lua #2 7 min 1,416 1193 7 min 0% 100% 1% 1%
75 Lua 7 min 1,388 1201 7 min 0% 0% 2% 98%
123 Perl #2 12 min 6,292 1429 12 min 96% 0% 0% 4%
145 Python 3 14 min 8,176 1196 14 min 2% 20% 79% 0%
153 Python 3 #2 15 min 8,260 1242 15 min 93% 1% 1% 7%
733 Matz's Ruby #2 1h 13 min 4,084 1137 1h 13 min 65% 0% 0% 35%