The Computer Language
Benchmarks Game

n-body

program source code, command-line and measurements

× source secs mem gz cpu cpu load
1.0 Fortran Intel #6 7.95 8 1518 7.94 1% 0% 1% 100%
1.2 C++ g++ #8 9.31 1,052 1544 9.30 1% 1% 1% 100%
1.2 C++ g++ #3 9.67 1,784 1763 9.66 1% 1% 100% 0%
1.2 C++ g++ #7 9.78 1,004 1545 9.78 100% 1% 0% 1%
1.2 Fortran Intel #5 9.81 8 1659 9.80 1% 1% 0% 100%
1.3 C gcc #4 9.96 1,016 1490 9.95 1% 1% 1% 100%
1.3 Ada 2005 GNAT #2 10.30 1,952 2604 10.30 1% 100% 0% 0%
1.6 C++ g++ #5 12.83 1,700 1749 12.82 1% 1% 0% 100%
1.6 Rust #3 13.08 5,704 1540 13.08 0% 1% 1% 100%
1.7 Rust #2 13.15 5,764 1799 13.14 1% 1% 1% 100%
1.7 Rust 13.55 5,688 1474 13.54 0% 1% 0% 100%
2.4 Ada 2005 GNAT #5 18.83 1,952 2436 18.82 1% 1% 0% 100%
2.5 Fortran Intel 19.49 8 1389 19.48 0% 1% 100% 1%
2.5 C++ g++ 19.61 1,048 1659 19.60 1% 100% 0% 0%
2.5 Fortran Intel #2 19.76 8 1496 19.75 1% 1% 0% 100%
2.6 C gcc 20.27 1,020 1173 20.26 1% 0% 100% 0%
2.6 C++ g++ #6 20.56 1,052 1668 20.55 0% 0% 100% 1%
2.6 C++ g++ #4 20.72 688 1428 20.71 100% 0% 1% 1%
2.6 C gcc #6 20.75 968 1180 20.74 13% 100% 5% 6%
2.6 Chapel 20.81 32,468 962 20.82 100% 0% 1% 0%
2.6 C gcc #5 21.00 732 1429 20.99 0% 1% 100% 1%
2.7 Go 21.52 832 1310 21.52 1% 100% 0% 0%
2.7 Java  #4 21.54 27,092 1489 21.56 1% 1% 100% 1%
2.7 C gcc #2 21.67 1,016 1263 21.66 0% 0% 100% 1%
2.7 OCaml 21.68 1,252 1239 21.67 0% 0% 100% 1%
2.7 C# .NET Core #3 21.70 38,396 1305 21.69 0% 73% 28% 1%
2.8 Swift #5 21.96 7,372 1253 21.95 1% 100% 0% 0%
2.8 C# .NET Core #8 21.98 38,468 1343 21.97 100% 0% 1% 0%
2.8 C# .NET Core #2 22.02 38,228 1410 22.01 100% 0% 1% 1%
2.8 Fortran Intel #4 22.04 8 1172 22.03 1% 0% 100% 1%
2.8 C# .NET Core 22.08 40,152 1403 22.08 1% 0% 1% 100%
2.8 Fortran Intel #3 22.10 8 1299 22.09 1% 0% 0% 100%
2.8 Go #2 22.23 832 1215 22.22 100% 0% 1% 1%
2.8 Pascal Free Pascal 22.35 8 1308 22.34 1% 0% 1% 100%
2.8 Java #3 22.48 27,664 1430 22.50 1% 100% 0% 1%
2.8 Java #2 22.59 29,372 1424 22.61 0% 1% 100% 1%
2.9 Pascal Free Pascal #2 22.75 8 1322 22.74 1% 100% 0% 0%
2.9 Java 23.28 28,044 1430 23.32 0% 100% 1% 1%
2.9 C gcc #3 23.42 976 1208 23.41 100% 0% 0% 1%
3.0 Ada 2005 GNAT #3 23.70 2,032 1740 23.69 1% 0% 0% 100%
3.0 Swift #6 23.73 7,224 1194 23.72 0% 0% 100% 1%
3.0 Swift #7 23.84 15,248 1445 23.83 0% 1% 100% 0%
3.1 C# .NET Core #6 24.55 40,380 1289 24.54 0% 100% 1% 0%
3.1 Ada 2005 GNAT 24.57 2,028 1608 24.56 0% 1% 0% 100%
3.1 Pascal Free Pascal #3 24.92 8 1418 24.91 1% 100% 0% 1%
3.1 Haskell GHC #2 25.02 14,668 1874 27.02 79% 3% 26% 4%
3.4 Haskell GHC 26.81 6,496 1706 29.06 46% 26% 38% 5%
3.4 Lisp SBCL #2 27.24 22,952 1398 27.23 1% 0% 0% 100%
3.5 Dart #3 27.50 48,620 1420 27.69 0% 1% 1% 100%
3.5 Node.js 27.76 27,704 1297 27.76 100% 0% 1% 1%
3.5 TypeScript #3 27.90 28,008 1348 27.89 1% 1% 0% 100%
3.6 Node.js #5 28.48 27,912 1193 28.48 100% 0% 1% 0%
3.7 Swift #3 29.16 7,356 1204 29.14 0% 1% 100% 0%
3.8 Dart #2 30.38 48,592 1274 30.57 0% 1% 100% 1%
3.8 Swift #2 30.53 7,356 1192 30.52 81% 3% 2% 21%
4.1 Node.js #4 32.94 27,680 1279 32.92 0% 100% 1% 1%
4.3 Node.js #2 33.94 27,940 1537 33.93 100% 1% 1% 0%
5.2 Lisp SBCL 41.60 22,920 1363 41.58 1% 0% 0% 100%
6.7 Racket #2 53.50 27,160 1689 53.48 100% 1% 1% 0%
15 Racket 115.63 27,416 1496 115.58 1% 0% 0% 100%
24 Smalltalk VW 194.34 56,384 1805 194.29 100% 0% 0% 1%
25 TypeScript 195.22 43,488 1462 194.88 100% 1% 1% 1%
26 Erlang HiPE #3 205.63 24,960 1399 205.62 13% 87% 0% 1%
29 TypeScript #2 228.56 43,108 1453 228.17 98% 2% 1% 3%
37 Ruby JRuby #2 290.75 708,196 1137 298.28 36% 30% 22% 18%
45 PHP #3 5 min 8,668 1082 5 min 17% 0% 1% 83%
47 Erlang #3 6 min 24,140 1399 6 min 1% 100% 0% 1%
49 Lua #2 6 min 1,176 1193 6 min 0% 1% 1% 100%
49 Lua #4 6 min 1,300 1305 6 min 0% 1% 1% 100%
54 Lua 7 min 1,312 1201 7 min 1% 100% 0% 1%
78 Hack #5 10 min 118,504 1432 10 min 1% 33% 68% 1%
91 Ruby #2 12 min 8,916 1137 12 min 25% 86% 1% 9%
96 Perl #2 12 min 5,052 1401 12 min 1% 1% 100% 1%
99 Python 3 13 min 7,744 1181 13 min 0% 1% 0% 100%
104 Python 3 #2 13 min 7,728 1228 13 min 100% 1% 0% 0%
166 Hack #3 21 min 118,396 1080 21 min 100% 1% 1% 1%
F# .NET Core Failed
F# .NET Core #2 Failed