The Computer Language
24.11 Benchmarks Game

n-body

First, here are a few naive un-optimised single-thread #8 programs transliterated lowest-common-denominator style into different programming languages from the same original —

  source secs mem gz    
  Swift #8 6.65 19,440 1285    
  C# .NET #8 7.21 29,068 1335    
  Dart #8 7.49 19,712 1268    
  Java #8 7.59 42,924 1322    
  Node.js #8 9.58 53,716 1173    
  Go #8 9.60 19,436 1224    
  PHP #8 65.76 19,712 1245    
  Java -Xint #8 160.65 37,692 1322    
  Ruby yjit #8 6 min 21,376 1160    
  Python 3 #8 8 min 19,312 1172    
 
 
  Here are the crowd sourced programs —  
 
 
× source secs mem gz cpu secs cpu load
1.0 Intel Fortran #5 3.39 19,648 1669 3.39 1% 0% 100% 0%
1.1 Julia #5 3.67 261,584 1129 3.77 0% 0% 96% 5%
1.1 Chapel #3 3.86 19,436 983 3.87 100% 0% 0% 0%
1.2 Rust #2 3.94 19,804 1809 3.94 0% 100% 0% 0%
1.3 Chapel #4 4.34 19,436 1027 4.34 100% 0% 0% 0%
1.3 Intel Fortran #2 4.46 19,776 1507 4.46 0% 0% 100% 0%
1.3 Rust #3 4.49 19,352 1774 4.49 100% 0% 0% 0%
1.3 Intel Fortran 4.55 19,648 1400 4.55 0% 0% 41% 59%
1.4 Intel Fortran #3 4.71 19,648 1311 4.71 100% 0% 0% 0%
1.5 C gcc #6 4.97 19,772 1186 4.97 0% 99% 0% 0%
1.5 Intel Fortran #6 5.01 19,648 1530 5.01 0% 0% 100% 0%
1.5 Rust #4 5.10 19,804 1810 5.10 62% 37% 0% 0%
1.5 C++ g++ #9 5.14 19,760 1536 5.14 0% 100% 0% 0%
1.5 C gcc #2 5.19 19,772 1270 5.19 0% 100% 0% 0%
1.5 C gcc #3 5.23 19,772 1214 5.23 0% 0% 0% 100%
1.5 C gcc 5.23 19,772 1179 5.23 97% 3% 0% 0%
1.6 C++ g++ #3 5.32 19,760 1402 5.32 91% 8% 0% 0%
1.6 Rust 5.51 19,804 1483 5.51 0% 100% 0% 0%
1.6 C gcc #8 5.54 19,492 1193 5.54 0% 0% 100% 0%
1.7 Chapel #2 5.67 19,436 977 5.67 99% 0% 0% 0%
1.7 Swift #6 5.78 19,440 1213 5.78 99% 0% 0% 0%
1.7 Ada 2012 GNAT #3 5.87 19,772 1758 5.87 0% 100% 0% 0%
1.9 Free Pascal 6.29 19,672 1331 6.29 0% 0% 100% 0%
1.9 Free Pascal #2 6.29 19,672 1345 6.29 0% 0% 0% 100%
1.9 C++ g++ #5 6.32 19,760 1544 6.32 100% 0% 0% 0%
1.9 Go #3 6.38 19,808 1207 6.40 0% 100% 0% 0%
1.9 Haskell GHC #2 6.39 19,808 1888 6.48 0% 0% 0% 99%
1.9 Julia #4 6.48 263,596 1168 6.57 0% 0% 1% 99%
2.0 C++ g++ 6.61 19,760 1666 6.61 93% 0% 0% 7%
2.0 C# .NET #3 6.65 29,280 1311 6.64 97% 2% 0% 0%
2.0 Swift #8 6.65 19,440 1285 6.65 3% 1% 0% 97%
2.0 C gcc #7 6.89 19,772 1250 6.88 63% 37% 0% 0%
2.0 C# .NET #2 6.89 29,284 1339 6.89 0% 0% 0% 100%
2.0 Java  #4 6.88 42,028 1495 6.91 1% 0% 99% 0%
2.0 F# .NET #4 6.91 36,692 1296 6.91 63% 36% 0% 0%
2.0 C++ g++ #6 6.93 19,760 1674 6.93 100% 0% 0% 0%
2.0 OCaml 6.94 19,676 1255 6.94 0% 100% 0% 0%
2.1 F# .NET #3 6.95 35,516 1624 6.95 99% 0% 0% 0%
2.1 Dart #6 6.97 19,712 1318 6.97 0% 0% 100% 0%
2.1 Julia #3 6.92 264,476 1548 7.01 99% 2% 0% 0%
2.1 Go 7.01 19,808 1316 7.03 100% 0% 0% 0%
2.1 Go #2 7.03 19,808 1222 7.05 100% 0% 0% 0%
2.1 Free Pascal #3 7.18 19,672 1441 7.18 100% 0% 0% 0%
2.1 C# .NET #8 7.21 29,068 1335 7.21 100% 0% 0% 0%
2.2 F# .NET #2 7.33 36,804 1387 7.33 95% 0% 4% 0%
2.2 Java #5 7.30 43,424 1435 7.36 0% 99% 0% 0%
2.2 Dart #8 7.49 19,712 1268 7.49 3% 96% 0% 0%
2.2 Java #2 7.48 42,260 1430 7.52 0% 0% 99% 0%
2.2 Java #3 7.49 42,292 1436 7.52 0% 0% 99% 0%
2.3 Ada 2012 GNAT 7.64 19,772 1624 7.64 0% 98% 1% 0%
2.3 Java #8 7.59 42,924 1322 7.64 0% 99% 0% 0%
2.3 C# .NET 7.66 29,380 1424 7.66 47% 53% 0% 0%
2.3 C# .NET #0 7.66 29,360 1342 7.66 69% 0% 30% 0%
2.3 Lisp SBCL #2 7.80 23,168 1408 7.80 0% 0% 100% 0%
2.3 Swift 7.85 19,440 1210 7.85 14% 0% 85% 0%
2.3 Java 7.84 42,652 1437 7.88 99% 0% 0% 0%
2.3 F# .NET 7.94 39,668 1272 7.93 4% 0% 96% 1%
2.5 Node.js #6 8.55 54,100 1274 8.56 0% 99% 0% 0%
2.6 Dart #2 8.91 19,712 1273 8.91 72% 28% 0% 0%
2.7 Lisp SBCL 9.25 23,168 1373 9.25 0% 100% 0% 0%
2.8 Node.js #8 9.58 53,716 1173 9.59 99% 0% 0% 0%
2.8 Go #8 9.60 19,436 1224 9.62 0% 0% 100% 0%
3.3 Dart #3 11.08 19,712 1413 11.08 63% 0% 0% 36%
8.5 Julia #2 28.72 278,196 1084 28.92 2% 98% 0% 0%
12 Racket 40.63 77,432 1503 40.62 0% 0% 100% 0%
19 PHP #8 65.76 19,712 1245 65.75 59% 31% 0% 10%
20 PHP #3 66.53 19,804 1088 66.52 0% 0% 0% 100%
31 Erlang #3 104.40 55,560 1405 104.46 0% 0% 0% 99%
32 VW Smalltalk 108.66 55,424 1787 108.65 0% 0% 100% 0%
55 Ruby yjit #3 186.79 20,864 1169 186.79 100% 0% 0% 0%
64 Ruby yjit #2 215.78 20,864 1143 215.77 0% 98% 2% 0%
65 Lua #2 220.08 19,656 1200 220.07 0% 0% 0% 100%
66 Lua #4 223.32 19,656 1312 223.30 100% 0% 0% 0%
77 Lua 262.10 19,656 1207 262.08 100% 0% 0% 0%
85 Swift #9 288.23 19,440 1532 288.20 71% 10% 4% 13%
105 Python 3 5 min 19,312 1201 5 min 97% 0% 0% 2%
111 Python 3 #2 6 min 19,312 1247 6 min 0% 100% 0% 0%
115 Ruby yjit #8 6 min 21,376 1160 6 min 0% 0% 0% 100%
131 Perl #2 7 min 19,688 1431 7 min 97% 0% 2% 0%
153 Python 3 #8 8 min 19,312 1172 8 min 100% 0% 0% 0%
208 Ruby yjit #7 11 min 21,120 1139 11 min 55% 0% 0% 45%
  Matz's Ruby #2 43 min 19,860 1143 43 min 100% 0% 0% 0%
  Matz's Ruby #3 43 min 19,684 1169 43 min 0% 0% 100% 0%
  Matz's Ruby #8 54 min 19,436 1160 54 min 0% 100% 0% 0%
Intel Fortran #4 Bad Output
Matz's Ruby #7 Failed
 
 
  * possible hand-written vector instructions | "unsafe"
 
× source secs mem gz cpu secs cpu load
0.6 * C gcc #9 2.10 19,772 1639 2.10 1% 100% 0% 0%
0.6 * C++ g++ #0 2.15 19,760 1933 2.15 0% 0% 0% 100%
0.6 * Rust #9 2.19 19,804 1881 2.19 0% 100% 0% 0%
0.9 * C# .NET #9 3.17 28,604 2480 3.17 0% 0% 99% 0%
1.0 * Rust #7 3.25 19,804 1759 3.24 0% 0% 100% 0%
1.1 * C# .NET #4 3.75 28,504 2137 3.75 0% 0% 100% 0%
1.2 * C gcc #4 4.05 19,772 1398 4.05 0% 0% 99% 0%
1.2 * C++ g++ #7 4.11 19,760 1815 4.11 8% 92% 1% 0%
1.3 * Rust #6 4.30 19,804 1796 4.30 100% 0% 0% 0%
1.4 * C# .NET #7 4.80 28,564 1715 4.80 13% 87% 0% 0%
1.4 * C# .NET #6 4.83 28,512 1754 4.83 9% 0% 0% 90%
1.5 * F# .NET #6 4.98 36,720 1395 4.97 0% 99% 0% 0%
1.5 * Rust #5 5.01 19,804 2224 5.01 0% 100% 0% 0%
1.6 * Swift #3 5.43 19,440 1688 5.43 1% 0% 0% 99%
1.6 * C gcc #5 5.43 19,772 1436 5.43 100% 0% 0% 0%
1.6 * C++ g++ #4 5.45 19,760 1434 5.45 0% 100% 0% 0%
1.6 * Swift #4 5.46 19,440 1361 5.46 0% 0% 0% 100%
1.6 * Swift #5 5.49 19,440 1372 5.49 0% 0% 0% 100%
1.6 * Swift #7 5.50 19,440 1333 5.50 0% 0% 0% 100%
1.7 * F# .NET #5 5.84 36,696 1363 5.84 0% 0% 99% 0%
1.8 * C++ g++ #2 6.02 19,352 1524 6.01 3% 0% 96% 1%
2.2 * Haskell GHC 7.19 19,808 1713 7.29 0% 0% 99% 0%
2.7 * Ada 2012 GNAT #5 9.00 19,772 2452 9.00 77% 0% 0% 22%
3.0 * Ada 2012 GNAT #2 10.14 19,772 2623 10.14 46% 53% 0% 0%
4.1 * Racket #2 14.04 77,392 1695 14.04 0% 100% 0% 0%