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 8.21 8 1524 8.21 0% 100% 1% 0%
1.0 C++ g++ #3 8.23 1,856 1763 8.23 100% 1% 1% 0%
1.1 Ada 2005 GNAT #2 8.83 2,072 2617 8.83 1% 0% 0% 100%
1.1 C++ g++ #8 9.02 1,128 1544 9.01 2% 100% 0% 0%
1.1 Fortran Intel #5 9.09 8 1664 9.09 100% 0% 1% 0%
1.1 C gcc #4 9.12 1,176 1490 9.12 1% 100% 2% 2%
1.2 C++ g++ #7 9.50 1,112 1545 9.49 0% 0% 0% 100%
1.5 C++ g++ #5 12.42 1,800 1749 12.42 0% 1% 0% 100%
1.7 Rust 13.57 1,728 1480 13.56 0% 0% 1% 100%
1.8 Rust #3 14.91 1,724 1540 14.90 0% 0% 100% 0%
2.1 Ada 2005 GNAT #5 17.02 2,128 2447 17.02 100% 0% 0% 1%
2.1 Rust #2 17.02 1,756 1805 17.02 0% 100% 1% 0%
2.2 Rust #4 17.88 1,740 1803 17.88 0% 100% 1% 0%
2.4 Fortran Intel 19.61 8 1393 19.61 100% 0% 1% 0%
2.4 C++ g++ 19.64 1,144 1659 19.64 1% 100% 0% 0%
2.4 Fortran Intel #2 19.71 8 1500 19.71 100% 0% 1% 0%
2.5 C gcc 20.13 1,160 1173 20.13 0% 1% 100% 0%
2.5 C++ g++ #4 20.28 896 1428 20.27 100% 1% 0% 0%
2.5 C gcc #5 20.33 816 1429 20.33 100% 1% 1% 0%
2.5 C++ g++ #6 20.49 1,164 1668 20.48 100% 1% 0% 0%
2.5 Chapel 20.60 4,872 962 20.60 100% 1% 1% 0%
2.6 C gcc #6 21.00 1,160 1180 21.00 2% 1% 100% 2%
2.6 C# .NET Core #7 21.37 34,120 1542 21.36 100% 1% 0% 1%
2.6 Haskell GHC #2 21.43 3,996 1883 84.71 98% 100% 99% 98%
2.6 Go #3 21.47 1,568 1200 21.47 78% 1% 1% 22%
2.6 Go 21.56 1,556 1310 21.56 100% 1% 1% 0%
2.6 OCaml 21.67 1,588 1251 21.67 61% 1% 0% 39%
2.6 Fortran Intel #4 21.68 8 1179 21.67 100% 0% 1% 0%
2.6 C gcc #2 21.70 1,160 1263 21.69 0% 1% 100% 0%
2.6 C# .NET Core #3 21.70 33,824 1305 21.69 1% 100% 1% 0%
2.6 C# .NET Core #5 21.73 33,768 1534 21.73 1% 1% 0% 100%
2.7 C# .NET Core #8 21.87 34,084 1343 21.86 1% 1% 1% 100%
2.7 Swift #5 21.96 7,452 1253 21.95 0% 1% 100% 0%
2.7 C# .NET Core #2 22.02 33,656 1410 22.02 100% 1% 1% 0%
2.7 Java  #5 22.10 33,136 1429 22.20 31% 1% 1% 70%
2.7 C# .NET Core 22.13 33,772 1403 22.12 100% 0% 1% 0%
2.7 Pascal Free Pascal 22.35 8 1325 22.35 0% 1% 1% 100%
2.7 Fortran Intel #3 22.41 8 1305 22.41 0% 1% 100% 0%
2.7 C# .NET Core #4 22.44 33,752 1404 22.44 100% 0% 1% 0%
2.7 Go #2 22.45 1,556 1215 22.45 0% 1% 0% 100%
2.7 Java #2 22.56 32,968 1424 22.66 2% 1% 0% 98%
2.8 Pascal Free Pascal #2 22.75 8 1339 22.74 100% 1% 1% 0%
2.8 F# .NET Core #2 22.86 38,500 1381 22.86 100% 0% 1% 1%
2.9 C gcc #3 23.44 1,164 1208 23.43 0% 0% 1% 100%
2.9 Swift #4 23.47 15,520 1357 23.46 1% 100% 0% 0%
2.9 Ada 2005 GNAT #3 23.56 2,208 1750 23.56 100% 0% 1% 0%
2.9 Swift #8 23.70 15,608 1346 23.69 4% 7% 1% 100%
2.9 Swift #7 23.77 15,696 1445 23.76 100% 1% 0% 0%
2.9 Swift #6 23.90 7,456 1194 23.89 100% 1% 0% 0%
2.9 Java #4 24.03 32,780 1489 24.12 0% 100% 2% 0%
2.9 Ada 2005 GNAT 24.11 2,096 1618 24.10 100% 0% 0% 1%
3.0 C# .NET Core #6 24.56 33,884 1289 24.56 100% 0% 1% 0%
3.0 Pascal Free Pascal #3 24.92 8 1435 24.92 1% 88% 13% 0%
3.1 Haskell GHC 25.13 4,060 1706 99.48 99% 99% 99% 100%
3.1 F# .NET Core 25.51 68,572 1267 25.60 48% 4% 9% 41%
3.1 Java #3 25.65 32,968 1430 25.74 100% 1% 0% 0%
3.2 Java 25.91 34,216 1430 26.02 0% 1% 0% 100%
3.2 Node.js 26.61 32,608 1297 26.61 0% 0% 1% 100%
3.3 TypeScript #3 27.07 32,028 1510 27.07 0% 0% 0% 100%
3.3 Lisp SBCL #2 27.25 18,044 1403 27.24 100% 0% 1% 0%
3.3 Dart #3 27.50 47,520 1426 27.64 0% 11% 89% 0%
3.6 Node.js #5 29.22 32,228 1193 29.22 0% 100% 1% 0%
3.9 Node.js #4 31.69 31,952 1279 31.69 0% 0% 0% 100%
3.9 Swift #2 32.39 7,476 1192 32.38 100% 1% 0% 1%
4.0 Dart #2 33.09 46,572 1278 33.27 0% 0% 1% 100%
5.0 Node.js #2 40.78 31,900 1537 40.78 0% 90% 10% 1%
5.0 Lisp SBCL 41.43 18,008 1368 41.42 0% 1% 1% 100%
6.5 Racket #2 53.10 28,276 1689 53.08 2% 7% 100% 4%
10 TypeScript 85.34 47,892 1631 85.71 0% 39% 62% 0%
11 TypeScript #2 91.76 45,696 1620 92.41 1% 45% 56% 1%
13 Racket 108.01 27,428 1496 107.97 98% 1% 3% 0%
23 Erlang HiPE #3 187.50 21,696 1399 187.50 45% 56% 0% 0%
24 Smalltalk VW 194.34 56,384 1805 194.29 100% 0% 0% 1%
25 Swift #3 207.82 7,388 1204 207.78 0% 1% 100% 0%
47 PHP #3 6 min 8,708 1082 6 min 0% 34% 68% 0%
49 Lua #4 6 min 1,404 1305 6 min 0% 98% 3% 0%
49 Ruby JRuby #2 6 min 775,148 1137 6 min 21% 20% 29% 36%
52 Lua #2 7 min 1,412 1193 7 min 0% 100% 1% 0%
56 Lua 7 min 1,488 1201 7 min 0% 100% 1% 0%
81 Hack #5 11 min 88,744 1439 11 min 9% 1% 1% 91%
87 Perl #2 11 min 5,244 1429 11 min 0% 1% 0% 100%
88 Ruby #2 12 min 8,916 1137 12 min 25% 86% 1% 9%
102 Python 3 13 min 10,324 1196 13 min 95% 1% 5% 0%
109 Python 3 #2 14 min 10,384 1242 14 min 19% 27% 55% 0%
203 Hack #3 27 min 87,344 1080 27 min 2% 26% 7% 67%
C# .NET Core #9 Bad Output