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.33 688 1753 3.42 0% 100% 2% 1%
1.1 Rust 3.63 688 1480 3.67 0% 100% 1% 0%
1.1 Rust #2 3.67 688 1805 3.74 0% 100% 1% 1%
1.2 Rust #8 3.86 688 1767 3.97 1% 100% 2% 0%
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 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 Julia #7 4.03 214,512 1112 4.35 99% 2% 3% 3%
1.2 C++ g++ #9 4.05 920 1773 4.14 0% 100% 0% 1%
1.3 Intel Fortran #6 4.21 8 1524 4.32 100% 1% 1% 0%
1.3 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.3 Julia #6 4.33 214,536 1430 4.68 2% 3% 99% 4%
1.5 Rust #5 4.85 684 2220 4.95 1% 0% 1% 100%
1.5 Rust #6 5.07 688 1790 5.17 1% 100% 0% 1%
1.5 Ada 2012 GNAT #2 5.12 1,784 2617 5.20 0% 1% 0% 100%
1.6 Rust #3 5.27 688 1540 5.37 0% 0% 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.49 0% 100% 1% 1%
1.6 Rust #4 5.38 688 1803 5.49 0% 1% 100% 1%
1.6 Intel Fortran 5.41 8 1393 5.43 0% 0% 0% 100%
1.6 Swift #8 5.43 12,276 1681 5.53 100% 1% 0% 0%
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 Julia #4 5.78 184,180 1155 6.12 2% 99% 3% 2%
1.8 C++ g++ 5.91 920 1659 6.06 0% 1% 2% 100%
1.8 C gcc #5 5.95 596 1429 6.03 100% 0% 1% 0%
1.8 Intel Fortran #5 5.96 8 1664 6.27 5% 100% 1% 0%
1.9 C gcc #3 6.16 924 1208 6.25 0% 100% 1% 0%
1.9 Intel Fortran #4 6.17 8 1179 6.33 100% 1% 0% 1%
1.9 Intel Fortran #3 6.31 8 1305 6.33 0% 0% 100% 0%
1.9 Swift #6 6.33 6,864 1194 6.45 100% 0% 1% 1%
1.9 Go #3 6.34 1,792 1200 6.44 1% 100% 0% 0%
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%
2.0 Free Pascal 6.51 8 1325 6.63 1% 0% 0% 100%
2.0 Free Pascal #2 6.62 8 1339 6.78 100% 1% 1% 0%
2.0 C gcc #2 6.63 924 1263 6.77 1% 100% 1% 0%
2.0 OCaml 6.70 1,364 1251 6.78 100% 1% 0% 0%
2.0 Go 6.71 1,824 1310 6.78 100% 0% 1% 0%
2.0 Java  #4 6.74 36,480 1489 6.84 100% 1% 0% 0%
2.0 Chapel #2 6.76 5,516 971 6.93 100% 1% 1% 1%
2.0 Julia #3 6.77 190,088 1541 7.14 3% 1% 100% 2%
2.1 C gcc 6.85 924 1173 7.01 1% 100% 1% 1%
2.1 C# .NET Core #8 6.89 32,456 1343 7.16 1% 3% 99% 1%
2.1 C# .NET Core #3 6.92 32,448 1305 6.95 99% 0% 0% 0%
2.1 Go #2 6.94 1,816 1215 7.07 1% 1% 100% 0%
2.1 Haskell GHC #2 6.95 4,188 1883 26.84 95% 95% 100% 95%
2.1 F# .NET Core #3 6.97 34,776 1617 7.28 100% 1% 3% 1%
2.1 Java #5 7.00 36,984 1429 7.20 1% 1% 100% 1%
2.2 Ada 2012 GNAT #3 7.22 1,788 1750 7.48 100% 0% 2% 1%
2.2 Java #3 7.26 36,788 1430 7.47 100% 1% 2% 1%
2.2 Java #2 7.33 36,700 1424 7.75 100% 1% 3% 2%
2.2 Free Pascal #3 7.47 8 1435 7.55 0% 0% 100% 1%
2.3 F# .NET Core #2 7.53 35,936 1381 7.68 1% 1% 1% 99%
2.3 Haskell GHC 7.61 4,176 1706 29.47 96% 96% 100% 96%
2.3 Java 7.70 38,408 1430 7.84 1% 0% 100% 1%
2.3 Lisp SBCL #2 7.81 18,232 1403 7.93 0% 1% 100% 1%
2.4 F# .NET Core #4 7.87 32,264 1290 8.02 99% 1% 1% 1%
2.5 Ada 2012 GNAT 8.17 1,788 1618 8.33 1% 1% 0% 100%
2.5 Dart #3 8.32 123,536 1409 8.63 99% 3% 1% 1%
2.5 Node js #6 8.35 35,628 1268 8.48 1% 100% 0% 0%
2.7 Ada 2012 GNAT #5 8.92 1,784 2447 9.04 0% 1% 100% 0%
2.9 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%
4.0 Lisp SBCL 13.16 18,244 1368 13.38 0% 100% 1% 1%
6.1 Julia #2 20.32 233,732 1078 21.06 100% 1% 2% 1%
7.6 Racket #2 25.37 36,652 1689 25.91 0% 1% 1% 100%
13 Racket 44.40 39,036 1496 45.01 0% 1% 100% 1%
32 VW Smalltalk 107.65 54,500 1782 110.11 1% 1% 1% 100%
42 Erlang HiPE #3 140.37 23,972 1399 143.03 1% 99% 1% 1%
57 Swift #3 190.37 6,768 1204 201.44 2% 2% 100% 1%
63 Lua #4 210.66 1,092 1305 212.11 0% 0% 0% 100%
65 Lua #2 217.52 1,084 1193 218.82 0% 100% 0% 0%
66 PHP #3 221.47 7,836 1082 226.63 1% 100% 1% 1%
70 Lua 231.79 1,080 1201 233.85 0% 0% 0% 100%
74 Ruby #2 246.88 22,032 1137 253.92 0% 1% 1% 100%
83 Swift #9 275.36 12,204 1526 281.52 1% 1% 1% 100%
124 Perl #2 6 min 6,564 1429 7 min 2% 2% 55% 47%
164 Python 3 9 min 8,160 1196 9 min 1% 1% 1% 100%
172 Python 3 #2 9 min 8,296 1242 9 min 100% 1% 1% 1%
689 Matz's Ruby #2 38 min 3,952 1137 1h 18 min 78% 12% 75% 40%
F# .NET Core Bad Output