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.6 Rust 13.24 1,704 1480 13.23 1% 1% 1% 100%
1.6 Rust #2 13.35 1,704 1805 13.35 100% 1% 0% 0%
2.1 Ada 2005 GNAT #5 17.02 2,128 2447 17.02 100% 0% 0% 1%
2.2 Rust #4 18.28 1,712 1803 18.27 0% 1% 100% 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 Rust #3 20.34 1,772 1540 20.34 100% 1% 0% 2%
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 Go 21.37 1,536 1310 21.38 0% 0% 100% 0%
2.6 Go #3 21.47 1,536 1200 21.47 0% 0% 100% 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 Haskell GHC #2 21.91 4,068 1883 21.91 100% 1% 0% 0%
2.7 Swift #4 21.93 15,648 1357 21.92 100% 1% 0% 0%
2.7 C# .NET Core #2 22.02 33,656 1410 22.02 100% 1% 1% 0%
2.7 C# .NET Core 22.13 33,772 1403 22.12 100% 0% 1% 0%
2.7 Java  #4 22.17 33,040 1489 22.27 100% 1% 0% 1%
2.7 Swift #5 22.18 7,632 1253 22.17 0% 1% 81% 19%
2.7 Pascal Free Pascal 22.35 8 1325 22.34 0% 0% 0% 100%
2.7 Java #2 22.38 33,084 1424 22.48 100% 1% 0% 1%
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.46 1,536 1215 22.46 1% 0% 0% 100%
2.7 Java #5 22.51 32,892 1429 22.61 1% 0% 0% 100%
2.7 Kotlin #2 22.55 32,788 1390 22.64 0% 1% 1% 100%
2.8 Java 22.73 34,464 1430 22.84 0% 91% 9% 1%
2.8 Pascal Free Pascal #2 22.74 8 1339 22.74 100% 1% 0% 0%
2.8 Java #3 22.78 33,160 1430 22.88 100% 1% 1% 1%
2.8 F# .NET Core #2 22.86 38,500 1381 22.86 100% 0% 1% 1%
2.8 Kotlin #5 23.08 33,068 1349 23.18 1% 99% 1% 1%
2.9 C gcc #3 23.44 1,164 1208 23.43 0% 0% 1% 100%
2.9 Ada 2005 GNAT #3 23.56 2,208 1750 23.56 100% 0% 1% 0%
2.9 Swift #8 23.77 15,632 1346 23.76 0% 1% 100% 0%
2.9 Swift #7 23.98 15,680 1445 23.98 90% 9% 14% 26%
2.9 F# .NET Core #3 24.09 37,096 1617 24.08 28% 73% 0% 1%
2.9 Ada 2005 GNAT 24.11 2,096 1618 24.10 100% 0% 0% 1%
3.0 Swift #6 24.24 7,592 1194 24.24 100% 1% 1% 0%
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.91 0% 0% 0% 100%
3.1 Haskell GHC 25.34 4,120 1706 100.24 99% 98% 100% 99%
3.1 F# .NET Core 25.51 68,572 1267 25.60 48% 4% 9% 41%
3.2 Node js 26.61 33,152 1297 26.61 100% 0% 0% 1%
3.3 TypeScript #3 27.11 32,772 1348 27.11 100% 0% 1% 0%
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.5 Node js #5 29.09 32,948 1193 29.09 100% 0% 0% 1%
3.9 Node js #4 31.69 32,632 1279 31.69 1% 0% 0% 100%
4.0 Swift #2 32.54 7,612 1192 32.53 88% 13% 0% 0%
4.0 Dart #2 33.09 46,572 1278 33.27 0% 0% 1% 100%
4.8 Node js #2 39.54 32,584 1537 39.54 100% 0% 0% 0%
5.0 Lisp SBCL 41.43 18,008 1368 41.42 0% 1% 1% 100%
6.6 Racket #2 53.89 26,192 1689 53.89 0% 0% 0% 100%
10 TypeScript 85.81 48,864 1462 86.16 12% 37% 49% 3%
13 Racket 108.53 26,300 1496 108.50 0% 1% 100% 0%
13 TypeScript #2 109.33 45,784 1453 111.19 2% 51% 48% 2%
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 203.61 7,488 1204 203.56 12% 88% 0% 0%
43 PHP #3 5 min 9,220 1082 5 min 0% 100% 1% 0%
49 Lua #4 6 min 1,404 1305 6 min 0% 98% 3% 0%
50 Ruby JRuby #2 6 min 804,512 1137 7 min 24% 43% 12% 26%
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%
78 Ruby #2 10 min 8,848 1137 10 min 8% 93% 0% 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%
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%
550 Ruby MRI #2 1h 15 min 3,972 1137 1h 15 min 56% 1% 1% 44%
C# .NET Core #9 Bad Output