The Computer Language
Benchmarks Game

n-body

program source code, command-line and measurements

× source secs mem gz cpu cpu load
1.0 C++ g++ #3 8.24 1,924 1763 8.23 1% 0% 100% 1%
1.0 Fortran Intel #6 8.28 8 1524 8.28 0% 1% 100% 0%
1.1 Ada 2012 GNAT #2 8.80 2,116 2617 8.79 1% 100% 0% 0%
1.1 C++ g++ #8 9.04 1,204 1544 9.04 0% 100% 0% 1%
1.1 Fortran Intel #5 9.10 8 1664 9.10 0% 0% 100% 0%
1.1 C gcc #4 9.17 1,228 1490 9.17 100% 0% 0% 1%
1.1 C++ g++ #7 9.42 1,188 1545 9.42 0% 1% 1% 100%
1.5 C++ g++ #5 12.42 1,980 1749 12.42 0% 100% 1% 0%
1.6 Rust #2 13.31 1,768 1805 13.31 0% 0% 1% 100%
1.6 Rust 13.53 1,804 1480 13.53 0% 100% 1% 0%
2.1 Ada 2012 GNAT #5 17.02 2,104 2447 17.02 1% 0% 0% 100%
2.2 Rust #4 18.30 1,764 1803 18.29 0% 0% 1% 100%
2.4 C++ g++ 19.65 1,208 1659 19.64 0% 0% 1% 100%
2.4 Fortran Intel 19.67 8 1393 19.66 0% 0% 100% 1%
2.4 Fortran Intel #2 19.71 8 1500 19.70 100% 0% 0% 1%
2.4 C gcc 20.10 1,220 1173 20.09 1% 0% 0% 100%
2.5 Rust #5 20.19 1,756 2220 20.18 100% 0% 1% 0%
2.5 Rust #3 20.21 1,744 1540 20.20 0% 100% 1% 0%
2.5 C++ g++ #4 20.29 868 1428 20.28 0% 0% 1% 100%
2.5 C gcc #5 20.34 828 1429 20.33 1% 0% 100% 0%
2.5 Rust #6 20.41 1,736 1790 20.40 100% 0% 1% 0%
2.5 C++ g++ #6 20.49 1,192 1668 20.49 0% 0% 1% 100%
2.5 Chapel 20.63 5,472 962 20.62 100% 1% 0% 1%
2.5 Go #3 21.00 1,532 1200 21.00 1% 0% 0% 100%
2.6 C gcc #6 21.02 1,220 1180 21.01 0% 0% 100% 1%
2.6 Go 21.38 1,480 1310 21.38 1% 0% 100% 0%
2.6 C# .NET Core #7 21.40 36,048 1542 21.40 100% 0% 1% 0%
2.6 Fortran Intel #4 21.62 8 1179 21.62 100% 0% 0% 1%
2.6 OCaml 21.67 1,524 1251 21.67 1% 0% 0% 100%
2.6 C# .NET Core #3 21.72 35,948 1305 21.73 0% 100% 1% 1%
2.6 C# .NET Core #5 21.73 35,776 1534 21.74 1% 100% 1% 1%
2.6 Swift #4 21.80 16,264 1357 21.79 1% 0% 1% 100%
2.6 C gcc #2 21.80 1,216 1263 21.80 0% 100% 0% 1%
2.7 Haskell GHC #2 21.91 4,068 1883 21.91 100% 1% 0% 0%
2.7 Fortran Intel #3 21.98 8 1305 21.97 83% 0% 0% 18%
2.7 Java  #4 22.00 32,496 1489 22.07 1% 100% 0% 1%
2.7 C# .NET Core #8 22.03 35,916 1343 22.04 1% 100% 0% 1%
2.7 C# .NET Core #2 22.14 35,916 1410 22.14 100% 2% 1% 0%
2.7 Java #5 22.15 32,388 1429 22.21 1% 0% 100% 0%
2.7 Swift #5 22.28 4,892 1253 22.27 1% 0% 100% 0%
2.7 Go #2 22.28 1,480 1215 22.28 0% 0% 0% 100%
2.7 Free Pascal 22.36 8 1325 22.35 100% 1% 2% 1%
2.7 C# .NET Core #4 22.48 35,848 1404 22.48 2% 0% 1% 100%
2.7 C# .NET Core 22.48 35,848 1403 22.48 0% 100% 0% 0%
2.7 Java #3 22.54 32,556 1430 22.61 100% 0% 0% 1%
2.7 Kotlin #2 22.55 32,788 1390 22.64 0% 1% 1% 100%
2.8 Free Pascal #2 22.75 8 1339 22.75 100% 0% 0% 1%
2.8 Java 22.86 33,312 1430 22.94 1% 100% 0% 0%
2.8 F# .NET Core #2 22.89 38,188 1381 22.90 0% 0% 100% 0%
2.8 Kotlin #5 23.08 33,068 1349 23.18 1% 99% 1% 1%
2.8 Swift #7 23.40 16,124 1445 23.39 39% 62% 0% 0%
2.8 C gcc #3 23.44 1,140 1208 23.44 0% 0% 100% 1%
2.9 Ada 2012 GNAT #3 23.57 2,096 1750 23.56 1% 0% 0% 100%
2.9 Swift #8 23.78 16,152 1346 23.77 1% 0% 0% 100%
2.9 Swift #6 24.04 4,896 1194 24.03 1% 0% 0% 100%
2.9 F# .NET Core #3 24.11 37,684 1617 24.11 1% 0% 0% 100%
2.9 Ada 2012 GNAT 24.11 2,144 1618 24.11 1% 0% 25% 75%
3.0 C# .NET Core #6 24.63 35,904 1289 24.63 1% 0% 1% 100%
3.0 Free Pascal #3 24.92 8 1435 24.92 100% 0% 0% 1%
3.0 Java #2 25.09 32,992 1424 25.16 1% 0% 100% 0%
3.1 F# .NET Core 25.13 68,676 1267 25.16 1% 44% 49% 7%
3.1 Haskell GHC 25.34 4,120 1706 100.24 99% 98% 100% 99%
3.2 Node js 26.35 33,228 1297 26.35 1% 0% 100% 0%
3.2 Java AOT 26.69 5,516 1430 26.68 0% 1% 100% 0%
3.3 TypeScript #3 26.96 32,432 1348 26.96 3% 100% 7% 4%
3.3 Lisp SBCL #2 27.13 17,764 1403 27.12 0% 100% 0% 1%
3.3 Java AOT #2 27.57 5,516 1424 27.56 0% 2% 100% 0%
3.4 Java AOT #3 27.71 5,496 1430 27.71 2% 100% 1% 0%
3.4 Java AOT #4 28.24 5,568 1489 28.23 0% 0% 1% 100%
3.4 Dart #3 28.41 129,076 1409 28.88 5% 44% 2% 52%
3.5 Node js #5 29.16 32,908 1193 29.16 100% 0% 0% 0%
3.6 Java AOT #5 29.93 5,568 1429 29.92 100% 0% 1% 0%
3.8 Node js #4 31.63 32,940 1279 31.63 100% 0% 0% 1%
3.9 Swift #2 31.72 4,976 1192 31.71 0% 0% 1% 100%
4.5 Node js #2 37.46 32,844 1537 37.46 100% 1% 0% 0%
4.6 Dart #2 38.19 131,396 1264 38.64 1% 1% 99% 1%
5.1 Truffle Ruby #2 42.02 336,436 1137 58.11 15% 14% 13% 96%
5.2 Lisp SBCL 42.61 17,764 1368 42.60 100% 0% 0% 1%
6.5 Racket #2 53.89 26,192 1689 53.89 0% 0% 0% 100%
10 TypeScript 85.59 44,084 1462 86.64 1% 1% 63% 38%
11 TypeScript #2 88.59 42,652 1453 90.07 53% 47% 2% 1%
13 Racket 108.53 26,300 1496 108.50 0% 1% 100% 0%
23 Erlang HiPE #3 188.59 23,660 1399 188.61 53% 0% 1% 48%
23 VW Smalltalk 193.54 54,728 1824 193.47 1% 59% 1% 42%
25 Swift #3 206.41 4,728 1204 206.37 1% 0% 100% 0%
43 PHP #3 5 min 9,220 1082 5 min 0% 100% 1% 0%
43 Ruby #2 5 min 12,284 1137 6 min 8% 95% 5% 5%
49 Lua #4 6 min 1,404 1305 6 min 0% 98% 3% 0%
52 Lua #2 7 min 1,412 1193 7 min 0% 100% 1% 0%
53 JRuby #2 7 min 793,604 1137 7 min 50% 4% 42% 8%
56 Lua 7 min 1,488 1201 7 min 0% 100% 1% 0%
76 Hack #5 10 min 132,048 1439 10 min 16% 0% 1% 84%
86 Perl #2 11 min 5,244 1429 11 min 0% 1% 0% 100%
107 Python 3 14 min 8,212 1196 14 min 91% 0% 1% 9%
114 Python 3 #2 15 min 8,272 1242 15 min 32% 0% 0% 69%
218 Hack #3 29 min 131,252 1082 29 min 8% 0% 83% 11%
539 Matz's Ruby #2 1h 13 min 3,856 1137 1h 13 min 0% 0% 99% 1%
C# .NET Core #9 Bad Output