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 #4 22.04 8 1172 22.03 0% 1% 1% 100%
1.0 Fortran Intel 19.60 8 1389 19.59 1% 100% 0% 1%
1.0 Fortran Intel #5 9.54 8 1659 9.53 100% 0% 1% 1%
1.0 Pascal Free Pascal 22.36 8 1308 22.35 1% 1% 0% 100%
1.0 Fortran Intel #6 8.11 8 1518 8.11 0% 1% 100% 1%
1.0 Pascal Free Pascal #3 24.93 8 1418 24.92 0% 1% 1% 100%
1.0 Pascal Free Pascal #2 22.75 8 1322 22.74 1% 0% 0% 100%
1.0 Fortran Intel #2 19.76 8 1496 19.75 0% 1% 0% 100%
1.0 Fortran Intel #3 22.10 8 1299 22.10 1% 0% 100% 1%
86 C++ g++ #4 20.20 684 1428 20.19 0% 0% 1% 100%
98 C gcc #5 20.98 784 1429 20.97 1% 1% 100% 2%
104 Go 21.52 832 1310 21.52 1% 1% 1% 100%
105 Go #2 22.23 836 1215 22.24 0% 100% 1% 1%
118 C++ g++ #7 9.65 940 1545 9.64 100% 1% 1% 1%
119 C gcc #3 20.97 952 1208 20.96 1% 1% 1% 100%
120 C gcc #6 21.14 956 1180 21.13 100% 1% 1% 0%
125 C gcc #4 9.56 1,000 1490 9.56 1% 100% 1% 1%
129 C gcc #2 22.38 1,028 1263 22.37 1% 0% 1% 100%
129 C gcc 21.15 1,028 1173 21.14 1% 100% 0% 2%
132 C++ g++ 19.37 1,056 1659 19.36 1% 100% 0% 0%
136 OCaml 21.69 1,084 1239 21.68 1% 1% 100% 1%
137 C++ g++ #6 19.20 1,096 1668 19.19 100% 1% 0% 0%
144 C++ g++ #8 9.37 1,152 1544 9.36 1% 0% 100% 1%
214 C++ g++ #3 9.30 1,712 1763 9.29 100% 1% 1% 0%
216 C++ g++ #5 11.76 1,728 1749 11.75 1% 100% 1% 0%
239 Ada 2005 GNAT #2 10.29 1,908 2604 10.29 100% 1% 0% 0%
242 Ada 2005 GNAT #5 18.66 1,936 2436 18.65 1% 1% 100% 0%
262 Ada 2005 GNAT #3 24.56 2,096 1740 24.55 1% 1% 1% 100%
263 Ada 2005 GNAT 26.22 2,104 1608 26.22 1% 0% 0% 100%
460 Rust #2 13.08 3,676 1799 13.08 1% 1% 100% 1%
465 Rust 13.56 3,720 1474 13.56 100% 1% 1% 0%
537 Swift #2 32.68 4,296 1192 32.67 0% 2% 1% 100%
538 Swift #6 25.26 4,300 1194 25.25 0% 1% 1% 100%
542 Swift #3 30.00 4,332 1204 29.99 1% 0% 100% 1%
542 Swift #5 23.59 4,336 1253 23.58 0% 100% 1% 0%
  Haskell GHC #2 24.48 7,856 1874 25.55 2% 100% 1% 2%
  Haskell GHC 26.62 7,924 1706 28.52 3% 96% 6% 3%
  Chapel 21.55 20,688 962 21.55 100% 0% 1% 0%
  Racket #2 53.26 21,476 1689 53.26 100% 1% 1% 1%
  Racket 123.11 21,588 1496 123.08 1% 100% 0% 1%
  Lisp SBCL 41.76 23,196 1363 41.74 1% 0% 100% 2%
  Lisp SBCL #2 28.49 23,196 1398 28.48 0% 1% 100% 0%
  Erlang HiPE #3 205.63 24,960 1399 205.62 13% 87% 0% 1%
  Java  #4 21.50 27,240 1489 21.52 1% 1% 100% 0%
  Node.js #5 28.49 27,612 1193 28.49 1% 0% 100% 1%
  Java 25.56 27,716 1430 25.60 0% 1% 1% 100%
  TypeScript #3 27.91 27,960 1348 27.90 1% 0% 100% 1%
  Node.js #4 32.90 28,168 1279 32.88 1% 1% 100% 1%
  Node.js 27.82 28,208 1297 27.81 1% 0% 1% 100%
  Node.js #2 33.96 28,340 1537 33.95 1% 3% 97% 1%
  Java #3 22.48 29,144 1430 22.50 2% 1% 100% 1%
  Java #2 22.59 29,184 1424 22.61 100% 1% 1% 0%
  C# .NET Core #8 21.99 34,984 1343 21.98 0% 1% 1% 100%
  C# .NET Core 22.25 36,992 1403 22.24 1% 0% 0% 100%
  C# .NET Core #6 24.55 37,168 1289 24.54 1% 1% 0% 100%
  C# .NET Core #2 22.03 37,220 1410 22.02 1% 100% 0% 1%
  C# .NET Core #3 21.69 37,272 1305 21.68 0% 100% 1% 2%
  Dart #2 30.38 47,900 1274 30.58 1% 100% 1% 1%
  Scala 23.88 48,660 1358 23.98 1% 1% 100% 1%
  Dart #3 27.51 49,836 1420 27.69 1% 1% 100% 1%
  F# .NET Core 25.38 74,468 1259 25.47 100% 2% 1% 1%
  Clojure #2 26.81 77,076 1440 27.95 2% 94% 2% 8%
  Clojure 26.36 80,540 2162 27.52 2% 2% 97% 4%
  Ruby JRuby #2 290.75 708,196 1137 298.28 36% 30% 22% 18%
Erlang #3 Partial
Hack #3 Partial
Hack #5 Partial
Lua #4 Partial
Lua Partial
Lua #2 Partial
Perl #2 Partial
PHP #3 Partial
Python 3 #2 Partial
Python 3 Partial
Ruby #2 Partial
TypeScript Partial
TypeScript #2 Partial
Smalltalk VW Partial