The Computer Language
Benchmarks Game

n-body

program source code, command-line and measurements

× source secs mem gz cpu cpu load
1.0 Rust #7 5.82 916 1753 5.82 2% 3% 100% 1%
1.4 Fortran Intel #6 8.28 8 1524 8.28 1% 0% 0% 100%
1.6 Ada 2012 GNAT #2 9.05 1,876 2617 9.05 0% 6% 95% 1%
1.6 Fortran Intel #5 9.10 8 1664 9.09 0% 100% 0% 1%
1.6 C gcc #4 9.37 1,088 1490 9.37 100% 0% 1% 0%
1.6 C++ g++ #7 9.37 1,712 1808 9.37 0% 2% 1% 100%
1.6 C++ g++ #3 9.42 1,704 1763 9.41 2% 100% 1% 0%
1.6 C++ g++ #8 9.58 1,084 1765 9.58 1% 0% 100% 0%
2.1 C++ g++ #5 12.30 1,768 1749 12.30 0% 1% 1% 100%
2.3 Rust 13.31 852 1480 13.30 0% 100% 0% 0%
2.3 Rust #2 13.43 852 1805 13.42 2% 84% 1% 16%
3.1 Ada 2012 GNAT #5 17.95 1,880 2447 17.94 100% 2% 1% 0%
3.1 Rust #4 18.31 916 1803 18.30 0% 0% 100% 0%
3.4 Fortran Intel 19.53 8 1393 19.53 0% 100% 1% 0%
3.4 C++ g++ 19.67 1,084 1659 19.66 100% 0% 1% 0%
3.4 Fortran Intel #2 19.71 8 1500 19.70 100% 0% 0% 0%
3.4 Rust #3 19.94 920 1540 19.94 0% 0% 1% 100%
3.4 Rust #5 20.05 916 2220 20.05 1% 0% 1% 100%
3.5 C++ g++ #6 20.11 1,088 1668 20.11 100% 1% 1% 0%
3.5 C gcc 20.26 1,088 1173 20.26 0% 100% 1% 0%
3.5 C++ g++ #4 20.30 824 1428 20.30 0% 0% 1% 100%
3.5 Rust #6 20.32 920 1790 20.31 0% 1% 100% 0%
3.6 C gcc #6 20.82 1,088 1180 20.82 1% 0% 0% 100%
3.6 Go #3 21.00 1,536 1200 21.00 0% 100% 0% 1%
3.7 Go 21.38 1,472 1310 21.38 0% 0% 0% 100%
3.7 C# .NET Core #7 21.41 36,520 1542 21.41 28% 0% 1% 72%
3.7 Fortran Intel #4 21.56 8 1179 21.56 100% 0% 0% 0%
3.7 C gcc #2 21.63 1,084 1263 21.62 1% 100% 0% 0%
3.7 OCaml 21.68 1,520 1251 21.68 1% 0% 100% 0%
3.7 C# .NET Core #5 21.74 36,536 1534 21.74 1% 100% 1% 0%
3.7 C# .NET Core #3 21.75 36,456 1305 21.75 1% 100% 0% 1%
3.8 Haskell GHC #2 21.99 3,984 1883 86.80 99% 98% 100% 99%
3.8 Swift #4 22.00 19,948 1355 21.99 1% 100% 0% 0%
3.8 Java  #4 22.00 32,272 1489 22.07 1% 0% 0% 100%
3.8 C# .NET Core #8 22.02 36,596 1343 22.02 1% 100% 2% 1%
3.8 Java #5 22.14 32,368 1429 22.21 0% 100% 1% 0%
3.8 C# .NET Core #2 22.14 36,432 1410 22.15 100% 1% 1% 1%
3.8 Swift #5 22.20 6,844 1253 22.19 0% 0% 1% 100%
3.8 Go #2 22.28 1,472 1215 22.28 0% 100% 1% 0%
3.8 Fortran Intel #3 22.36 8 1305 22.35 100% 0% 0% 0%
3.8 Free Pascal 22.36 8 1325 22.35 1% 0% 0% 100%
3.9 C# .NET Core 22.46 36,516 1403 22.46 1% 1% 1% 100%
3.9 C# .NET Core #4 22.48 36,552 1404 22.49 100% 1% 1% 0%
3.9 Java #3 22.54 32,408 1430 22.61 0% 100% 2% 0%
3.9 C gcc #7 22.69 1,084 1244 22.68 0% 0% 0% 100%
3.9 Free Pascal #2 22.75 8 1339 22.75 100% 1% 0% 0%
3.9 Julia 22.85 169,788 1149 23.16 2% 100% 1% 1%
3.9 Java 22.86 33,108 1430 22.94 0% 100% 1% 0%
3.9 F# .NET Core #2 22.90 38,416 1381 22.90 0% 0% 1% 100%
4.0 C gcc #3 23.45 1,088 1208 23.44 100% 0% 1% 0%
4.1 Swift #7 23.63 19,876 1445 23.62 0% 0% 1% 100%
4.1 Ada 2012 GNAT #3 23.78 1,944 1750 23.78 0% 0% 1% 100%
4.1 C gcc #5 23.80 824 1429 23.80 100% 0% 1% 0%
4.1 Haskell GHC 23.83 3,888 1706 94.19 99% 99% 99% 100%
4.1 Swift #8 23.90 20,032 1346 23.90 0% 1% 1% 100%
4.1 Chapel 23.94 5,068 962 23.93 100% 1% 1% 0%
4.1 F# .NET Core #3 24.11 37,968 1617 24.12 0% 1% 100% 0%
4.2 Swift #6 24.35 6,764 1194 24.35 100% 1% 1% 0%
4.2 C# .NET Core #6 24.60 36,392 1289 24.61 100% 1% 1% 1%
4.3 Free Pascal #3 24.93 8 1435 24.92 0% 100% 1% 1%
4.3 Java #2 25.04 32,352 1424 25.11 0% 100% 0% 1%
4.3 F# .NET Core 25.12 68,852 1267 25.15 91% 1% 1% 9%
4.4 Substrate VM #4 25.54 6,500 1489 25.53 1% 0% 0% 100%
4.5 Substrate VM #3 26.05 6,536 1430 26.04 0% 1% 100% 0%
4.5 Substrate VM #2 26.25 6,536 1424 26.24 0% 100% 1% 0%
4.5 Lisp SBCL #2 26.25 17,500 1403 26.24 100% 1% 1% 0%
4.5 Node js 26.31 33,476 1297 26.30 0% 0% 1% 100%
4.5 Substrate VM 26.33 5,036 1430 26.33 100% 0% 1% 0%
4.7 TypeScript #3 27.11 32,768 1348 27.11 0% 100% 1% 0%
4.7 Dart app-jit #3 27.38 73,928 1409 27.51 0% 100% 1% 0%
4.8 Ada 2012 GNAT 28.16 1,884 1618 28.15 100% 0% 0% 0%
4.9 Dart #3 28.81 121,680 1409 29.27 1% 99% 1% 1%
5.2 Substrate VM #5 30.05 6,488 1429 30.05 0% 0% 0% 100%
5.3 Node js #5 30.67 33,012 1193 30.67 0% 1% 0% 100%
5.5 Node js #4 31.97 33,180 1279 31.97 1% 0% 100% 0%
5.9 Dart app-jit #2 34.16 77,404 1264 34.30 100% 1% 1% 0%
5.9 Swift #2 34.54 6,812 1192 34.53 100% 1% 1% 0%
6.5 Node js #2 37.75 33,260 1537 37.75 0% 100% 0% 0%
7.1 Dart #2 41.18 115,612 1264 41.62 1% 65% 35% 1%
7.1 Lisp SBCL 41.45 17,468 1368 41.44 0% 100% 1% 0%
7.3 Truffle Ruby #2 42.28 343,684 1137 58.67 14% 98% 15% 13%
8.3 Julia #2 48.17 217,796 1078 48.47 100% 1% 1% 1%
9.3 Racket #2 54.21 48,080 1689 54.18 0% 100% 1% 0%
14 TypeScript 80.50 34,748 1462 80.92 100% 1% 1% 0%
14 TypeScript #2 84.13 35,120 1453 84.54 40% 1% 1% 61%
15 Racket 88.91 48,064 1496 88.82 89% 1% 1% 11%
33 VW Smalltalk 191.98 54,500 1824 191.93 0% 100% 0% 0%
33 Erlang HiPE #3 193.34 23,508 1399 193.35 0% 0% 1% 99%
38 Swift #3 219.34 6,716 1204 219.29 40% 1% 1% 60%
38 JRuby #2 222.49 809,600 1137 235.42 21% 35% 38% 13%
57 PHP #3 5 min 9,400 1082 5 min 44% 30% 1% 27%
67 Ruby #2 6 min 16,196 1137 7 min 48% 4% 10% 51%
68 Lua #4 6 min 1,396 1305 6 min 0% 6% 94% 1%
71 Lua #2 6 min 1,344 1193 6 min 74% 0% 0% 27%
76 Lua 7 min 1,348 1201 7 min 1% 0% 100% 0%
128 Perl #2 12 min 5,532 1429 12 min 71% 0% 1% 29%
146 Python 3 #2 14 min 7,916 1242 14 min 0% 0% 0% 100%
151 Python 3 14 min 7,920 1196 14 min 27% 47% 8% 21%
  Matz's Ruby #2 1h 13 min 3,856 1137 1h 13 min 0% 0% 99% 1%
C# .NET Core #9 Bad Output