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 6.07 940 1753 6.16 100% 1% 0% 0%
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 Fortran Intel #6 8.29 8 1524 8.40 100% 0% 0% 1%
1.4 C gcc #4 8.73 1,104 1490 9.25 2% 100% 4% 0%
1.5 Fortran Intel #5 9.10 8 1664 9.19 1% 0% 100% 0%
1.6 Ada 2012 GNAT #2 9.51 1,972 2617 9.56 0% 0% 0% 100%
2.2 Rust #8 13.15 940 1767 13.47 100% 1% 1% 1%
2.2 C++ g++ #5 13.29 1,804 1749 13.69 2% 1% 0% 100%
2.2 Rust #2 13.47 936 1805 13.57 0% 0% 100% 0%
2.2 Rust 13.60 876 1480 13.77 1% 0% 100% 0%
2.6 Ada 2012 GNAT #5 15.63 1,972 2447 15.84 0% 1% 1% 100%
3.0 Rust #4 18.48 940 1803 18.67 1% 0% 0% 100%
3.2 Fortran Intel 19.53 8 1393 19.74 1% 0% 0% 100%
3.2 C++ g++ 19.71 1,072 1659 19.95 0% 1% 100% 0%
3.2 Fortran Intel #2 19.71 8 1500 19.87 100% 0% 0% 1%
3.3 C++ g++ #6 19.75 1,076 1668 19.86 100% 0% 0% 0%
3.3 Rust #3 20.14 940 1540 20.39 0% 0% 0% 100%
3.3 Rust #5 20.27 876 2220 20.40 0% 28% 72% 0%
3.4 Rust #6 20.33 940 1790 20.51 0% 0% 100% 0%
3.5 C gcc #3 21.13 1,108 1208 21.33 0% 100% 1% 0%
3.5 Go 21.25 1,588 1310 21.82 2% 0% 100% 1%
3.6 Fortran Intel #4 21.56 8 1179 21.91 1% 0% 0% 100%
3.6 OCaml 21.68 1,556 1251 21.89 0% 100% 1% 0%
3.6 C# .NET Core #3 21.82 33,956 1305 22.24 1% 1% 1% 100%
3.6 Chapel 21.85 5,508 962 22.10 100% 0% 0% 1%
3.6 Haskell GHC #2 21.87 4,364 1883 86.49 99% 100% 99% 98%
3.6 Java  #5 21.93 35,408 1429 22.44 1% 0% 100% 1%
3.6 Swift #4 22.03 12,160 1355 22.25 0% 0% 100% 1%
3.6 C# .NET Core #8 22.13 33,748 1343 22.36 1% 0% 0% 100%
3.6 Fortran Intel #3 22.15 8 1305 22.38 1% 0% 0% 100%
3.7 C# .NET Core #7 22.27 34,280 1542 22.87 0% 3% 100% 0%
3.7 Free Pascal 22.36 8 1325 22.46 0% 100% 0% 0%
3.7 Julia #3 22.53 179,180 1541 23.14 100% 1% 1% 1%
3.7 C# .NET Core #2 22.54 33,684 1410 22.75 100% 1% 0% 0%
3.7 Free Pascal #2 22.75 8 1339 22.85 100% 0% 0% 0%
3.8 F# .NET Core #2 22.76 36,616 1381 23.42 100% 1% 2% 1%
3.8 Julia 22.81 174,144 1149 23.44 2% 1% 1% 100%
3.8 C# .NET Core 22.96 33,808 1403 23.40 1% 0% 1% 100%
3.8 C# .NET Core #4 22.97 34,892 1404 23.15 0% 100% 0% 0%
3.8 C gcc #7 23.01 1,104 1244 24.12 4% 1% 0% 100%
3.8 Node js #6 23.25 35,112 1268 24.63 5% 0% 100% 0%
3.9 C++ g++ #4 23.67 780 1428 24.09 0% 1% 1% 100%
3.9 C# .NET Core #5 23.69 34,464 1534 24.02 0% 1% 100% 0%
3.9 C gcc #5 23.83 844 1429 23.94 0% 0% 0% 100%
3.9 Haskell GHC 23.83 4,224 1706 94.35 99% 100% 99% 99%
3.9 Ada 2012 GNAT #3 23.84 2,040 1750 24.13 100% 0% 0% 1%
3.9 Node js 23.94 35,080 1297 25.59 5% 0% 47% 55%
4.0 Java #4 23.98 35,448 1489 24.37 1% 100% 1% 0%
4.0 C gcc 24.14 1,100 1173 24.43 0% 1% 100% 0%
4.0 F# .NET Core 24.27 46,504 1267 24.93 77% 4% 7% 15%
4.0 F# .NET Core #3 24.27 36,128 1617 24.53 1% 0% 0% 100%
4.0 C gcc #6 24.30 1,104 1180 24.59 0% 1% 100% 0%
4.0 Swift #6 24.32 6,684 1194 24.63 0% 100% 0% 1%
4.1 C# .NET Core #6 24.59 33,816 1289 25.51 2% 100% 2% 0%
4.1 F# .NET Core #4 24.70 37,656 1354 25.01 100% 0% 0% 1%
4.1 TypeScript #3 24.84 35,568 1354 26.48 3% 3% 100% 0%
4.1 Free Pascal #3 24.93 8 1435 25.25 0% 1% 1% 100%
4.1 Java #2 25.17 35,732 1424 25.53 100% 1% 0% 0%
4.2 Java #3 25.30 35,532 1430 25.96 0% 1% 100% 1%
4.2 C gcc #2 25.43 1,104 1263 25.59 100% 0% 1% 0%
4.2 Go #3 25.61 1,604 1200 25.89 0% 10% 91% 0%
4.3 Java 25.81 36,948 1430 26.20 0% 1% 1% 100%
4.3 Swift #8 25.88 12,032 1681 26.22 100% 0% 0% 1%
4.3 Lisp SBCL #2 26.25 18,060 1403 26.61 1% 0% 100% 1%
4.4 Go #2 26.75 1,588 1215 26.97 0% 1% 0% 100%
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%
4.7 Node js #4 28.61 35,036 1279 30.58 1% 3% 91% 11%
4.9 Node js #5 29.46 34,852 1193 31.35 39% 62% 0% 4%
5.4 Dart #2 32.87 109,700 1264 34.04 99% 2% 2% 1%
5.7 Node js #2 34.61 35,380 1537 37.10 48% 53% 5% 1%
5.7 Swift #2 34.82 6,764 1192 35.21 100% 0% 0% 1%
6.9 Lisp SBCL 41.81 18,012 1368 42.17 1% 0% 100% 0%
7.9 Julia #2 48.11 244,316 1078 48.81 0% 100% 0% 1%
9.2 Racket #2 55.55 38,116 1689 56.63 1% 0% 100% 1%
15 Racket 90.25 41,160 1496 91.47 13% 70% 4% 14%
29 TypeScript #2 173.69 38,856 1463 185.24 35% 21% 18% 33%
29 TypeScript 175.00 37,124 1471 186.33 21% 23% 37% 26%
32 Erlang HiPE #3 194.05 24,108 1399 196.23 100% 0% 0% 1%
32 VW Smalltalk 196.18 55,120 1782 198.51 0% 100% 0% 1%
36 Swift #3 217.12 6,732 1204 220.81 1% 36% 64% 1%
51 PHP #3 5 min 8,040 1082 5 min 65% 16% 5% 16%
62 Ruby #2 6 min 25,668 1137 6 min 67% 20% 2% 14%
67 Lua #4 6 min 1,368 1305 6 min 0% 0% 1% 100%
71 Swift #9 7 min 12,048 1526 7 min 2% 55% 44% 1%
73 Lua #2 7 min 1,416 1193 7 min 0% 100% 1% 1%
74 Lua 7 min 1,388 1201 7 min 0% 0% 2% 98%
121 Perl #2 12 min 6,292 1429 12 min 96% 0% 0% 4%
143 Python 3 14 min 8,176 1196 14 min 2% 20% 79% 0%
151 Python 3 #2 15 min 8,260 1242 15 min 93% 1% 1% 7%
723 Matz's Ruby #2 1h 13 min 4,084 1137 1h 13 min 65% 0% 0% 35%