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 3.42 1,844 1753 3.44 100% 0% 0% 0%
1.1 Rust #2 3.75 688 1805 3.77 100% 1% 0% 0%
1.1 Rust 3.80 688 1480 4.27 6% 6% 0% 100%
1.2 Rust #8 3.93 688 1767 4.05 1% 100% 1% 1%
1.2 C++ g++ #7 3.94 1,604 1808 4.02 0% 1% 100% 1%
1.2 C++ g++ #8 3.94 924 1765 3.98 1% 0% 0% 100%
1.2 Julia #7 3.99 212,216 1112 4.26 99% 3% 2% 3%
1.2 C++ g++ #3 3.99 1,604 1763 4.10 100% 1% 1% 1%
1.2 C++ g++ #2 4.02 1,608 1879 4.15 1% 0% 100% 2%
1.2 C++ g++ #9 4.05 920 1773 4.14 0% 100% 0% 1%
1.2 Julia #6 4.07 212,896 1430 4.41 4% 100% 2% 3%
1.2 Intel Fortran #6 4.21 8 1524 4.23 0% 0% 0% 100%
1.2 C gcc #8 4.25 8 1391 4.37 100% 0% 2% 0%
1.3 C gcc #4 4.29 924 1490 4.62 7% 1% 100% 0%
1.4 C# .NET Core #2 4.83 31,488 1742 4.82 99% 0% 0% 0%
1.4 Rust #5 4.84 692 2220 4.85 0% 100% 0% 0%
1.5 Rust #6 5.05 688 1790 5.07 0% 100% 0% 0%
1.5 Ada 2012 GNAT #2 5.12 1,784 2617 5.20 0% 1% 0% 100%
1.5 Rust #4 5.22 688 1803 5.42 0% 2% 100% 2%
1.6 Swift #4 5.33 12,352 1355 5.52 100% 1% 1% 1%
1.6 Intel Fortran #2 5.37 8 1500 5.47 0% 100% 2% 0%
1.6 Intel Fortran 5.41 8 1393 5.48 0% 100% 1% 0%
1.6 Swift #8 5.43 12,276 1681 5.53 100% 1% 0% 0%
1.6 Rust #3 5.51 688 1540 5.61 2% 0% 0% 100%
1.6 Julia #4 5.63 181,708 1155 6.02 100% 2% 3% 3%
1.7 C++ g++ #6 5.67 924 1668 5.74 0% 100% 1% 0%
1.7 C++ g++ #4 5.69 596 1428 5.98 100% 2% 2% 1%
1.7 C++ g++ #5 5.77 1,608 1749 5.86 100% 1% 0% 0%
1.7 C++ g++ 5.91 920 1659 6.06 0% 1% 2% 100%
1.7 C gcc #5 5.95 596 1429 6.03 100% 0% 1% 0%
1.7 Intel Fortran #5 5.97 8 1664 6.05 100% 1% 1% 0%
1.8 Intel Fortran #4 6.15 8 1179 6.18 0% 100% 0% 0%
1.8 C gcc #3 6.16 924 1208 6.25 0% 100% 1% 0%
1.8 Free Pascal 6.28 8 1325 6.30 100% 0% 0% 0%
1.8 Free Pascal #2 6.28 8 1339 6.28 0% 0% 0% 100%
1.8 Intel Fortran #3 6.31 8 1305 6.53 0% 100% 1% 2%
1.9 Swift #6 6.33 6,864 1194 6.45 100% 0% 1% 1%
1.9 Go #3 6.38 1,768 1200 6.38 0% 0% 0% 100%
1.9 C gcc #6 6.45 924 1180 6.54 0% 0% 100% 1%
1.9 C gcc #7 6.45 920 1244 6.55 100% 0% 1% 1%
1.9 C gcc #2 6.63 924 1263 6.77 1% 100% 1% 0%
1.9 Go 6.65 1,800 1310 6.81 100% 0% 0% 2%
2.0 OCaml 6.71 1,324 1251 6.74 100% 0% 0% 0%
2.0 Julia #3 6.75 187,688 1541 7.09 2% 100% 2% 2%
2.0 Java  #4 6.76 35,156 1489 6.83 1% 0% 100% 1%
2.0 Chapel #2 6.76 5,516 971 6.93 100% 1% 1% 1%
2.0 C gcc 6.85 924 1173 7.01 1% 100% 1% 1%
2.0 Go #2 6.88 1,760 1215 6.89 0% 100% 0% 0%
2.0 C# .NET Core #8 6.88 32,596 1343 6.93 99% 0% 1% 1%
2.0 C# .NET Core #3 6.91 32,704 1305 6.92 0% 0% 99% 0%
2.0 Haskell GHC #2 6.95 4,188 1883 26.84 95% 95% 100% 95%
2.0 F# .NET Core #3 6.97 34,776 1617 7.28 100% 1% 3% 1%
2.0 Java #5 6.99 35,712 1429 7.25 1% 100% 1% 3%
2.1 Free Pascal #3 7.16 8 1435 7.19 0% 100% 0% 0%
2.1 Ada 2012 GNAT #3 7.22 1,788 1750 7.48 100% 0% 2% 1%
2.2 Java #2 7.43 35,496 1424 7.70 1% 100% 1% 2%
2.2 Java #3 7.44 35,396 1430 7.54 100% 0% 1% 1%
2.2 F# .NET Core #2 7.53 35,936 1381 7.68 1% 1% 1% 99%
2.2 Haskell GHC 7.61 4,176 1706 29.47 96% 96% 100% 96%
2.3 Lisp SBCL #2 7.78 18,192 1403 7.83 0% 0% 100% 0%
2.3 Java 7.79 37,672 1430 7.88 100% 0% 0% 1%
2.3 F# .NET Core #4 7.87 32,264 1290 8.02 99% 1% 1% 1%
2.4 Ada 2012 GNAT 8.17 1,788 1618 8.33 1% 1% 0% 100%
2.4 Dart #3 8.32 123,536 1409 8.63 99% 3% 1% 1%
2.5 Node js #6 8.38 35,220 1268 8.47 1% 0% 100% 0%
2.6 Ada 2012 GNAT #5 8.92 1,784 2447 9.04 0% 1% 100% 0%
2.8 Swift #2 9.60 6,884 1192 10.02 0% 100% 1% 3%
3.4 Dart #2 11.47 147,908 1264 11.93 2% 2% 99% 1%
3.9 Lisp SBCL 13.22 18,220 1368 13.25 100% 0% 0% 0%
7.0 Julia #2 23.86 256,568 1078 24.28 1% 1% 100% 1%
7.4 Racket #2 25.31 37,220 1689 25.41 100% 0% 0% 0%
13 Racket 44.54 39,196 1496 44.85 0% 100% 0% 0%
31 VW Smalltalk 107.65 54,500 1782 110.11 1% 1% 1% 100%
41 Erlang HiPE #3 140.37 23,972 1399 143.03 1% 99% 1% 1%
56 Swift #3 190.37 6,768 1204 201.44 2% 2% 100% 1%
62 Lua #4 210.66 1,092 1305 212.11 0% 0% 0% 100%
64 Lua #2 217.52 1,084 1193 218.82 0% 100% 0% 0%
65 PHP #3 221.47 7,836 1082 226.63 1% 100% 1% 1%
68 Lua 231.79 1,080 1201 233.85 0% 0% 0% 100%
72 Ruby #2 246.88 22,032 1137 253.92 0% 1% 1% 100%
81 Swift #9 275.36 12,204 1526 281.52 1% 1% 1% 100%
120 Perl #2 6 min 6,564 1429 7 min 2% 2% 55% 47%
160 Python 3 9 min 8,160 1196 9 min 1% 1% 1% 100%
168 Python 3 #2 9 min 8,296 1242 9 min 100% 1% 1% 1%
671 Matz's Ruby #2 38 min 3,952 1137 1h 18 min 78% 12% 75% 40%
F# .NET Core Bad Output