Go Versus Java benchmarks

Current benchmark data was generated on Sat Nov 27 2021, full log can be found HERE

CONTRIBUTIONS are WELCOME!

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
java 2.java 668ms 11ms 492.7MB 613ms 133ms openjdk/parallelgc 17.0.1
java 2.java 670ms 2.4ms 407.3MB 650ms 103ms openjdk 18
java 2.java 736ms 8.5ms 406.3MB 677ms 153ms openjdk 17.0.1
java 2.java 1054ms 14ms 679.6MB 763ms 197ms graal/jvm 17.0.1
java 2.java 1315ms 39ms 1106.5MB 847ms 677ms openjdk/zgc 17.0.1
java 2.java 1406ms 3.7ms 298.2MB 1273ms 120ms graal/native 21.3.0
go 2.go 2288ms 38ms 70.9MB 4367ms 70ms go 1.17.3
go 1.go 3013ms 7.1ms 43.0MB 4423ms 47ms go 1.17.3
go 1.go 4494ms 15ms 39.3MB 4477ms 3ms tinygo 0.21.0
go 2.go 4730ms 9.0ms 39.6MB 4703ms 13ms tinygo 0.21.0

Input: 14

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 2.go 76ms 8.3ms 8.2MB 127ms 0ms go 1.17.3
java 2.java 104ms 2.7ms 69.2MB 103ms 20ms openjdk/parallelgc 17.0.1
java 2.java 108ms 14ms 129.2MB 40ms 47ms graal/native 21.3.0
java 2.java 109ms 3.2ms 89.7MB 93ms 20ms openjdk 17.0.1
go 1.go 114ms 2.7ms 8.3MB 123ms 0ms go 1.17.3
java 2.java 139ms 52ms 88.1MB 100ms 20ms openjdk 18
go 1.go 176ms 1.2ms 3.1MB 167ms 0ms tinygo 0.21.0
java 2.java 211ms 27ms 138.5MB 113ms 100ms openjdk/zgc 17.0.1
go 2.go 217ms 0.8ms 3.6MB 207ms 0ms tinygo 0.21.0
java 2.java 477ms 28ms 142.7MB 153ms 53ms graal/jvm 17.0.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 1122ms 88ms 15.3MB 1770ms 23ms go 1.17.3
go 1.go 1773ms 1.5ms 253.6MB 1657ms 90ms tinygo 0.21.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 128ms 46ms 5.3MB 160ms 3ms go 1.17.3
go 1.go 291ms 10ms 65.9MB 257ms 10ms tinygo 0.21.0
java 1.java 965ms 161ms 111.0MB 1447ms 50ms loom 18

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 237ms 37ms 10.0MB 163ms 43ms go 1.17.3
java 1.java 906ms 46ms 182.8MB 1297ms 143ms openjdk 18
java 1.java 991ms 188ms 290.3MB 1470ms 150ms openjdk/parallelgc 17.0.1
java 1.java 1101ms 8.6ms 447.4MB 1303ms 267ms graal/jvm 17.0.1
java 1.java 1114ms 119ms 178.0MB 1637ms 127ms openjdk 17.0.1
java 1.java 1146ms 7.9ms 265.7MB 983ms 147ms graal/native 21.3.0
java 1.java 1212ms 82ms 450.9MB 1653ms 380ms openjdk/zgc 17.0.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 93ms 4.2ms 9.9MB 43ms 20ms go 1.17.3
java 1.java 362ms 12ms 168.2MB 267ms 77ms graal/native 21.3.0
java 1.java 503ms 48ms 121.7MB 723ms 63ms openjdk 17.0.1
java 1.java 505ms 39ms 110.5MB 670ms 60ms openjdk 18
java 1.java 547ms 44ms 108.5MB 757ms 77ms openjdk/parallelgc 17.0.1
java 1.java 641ms 15ms 212.9MB 800ms 187ms openjdk/zgc 17.0.1
java 1.java 844ms 23ms 252.9MB 680ms 120ms graal/jvm 17.0.1

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 3.go 1210ms 2.3ms 2.8MB 2330ms 0ms go 1.17.3
java 1.java 1458ms 9.4ms 37.7MB 2780ms 7ms openjdk 17.0.1
java 1.java 1488ms 2.8ms 38.3MB 2840ms 13ms openjdk/parallelgc 17.0.1
java 1.java 1565ms 77ms 37.7MB 3000ms 17ms openjdk 18
java 1.java 1573ms 19ms 37.8MB 2917ms 57ms openjdk/zgc 17.0.1
java 1.java 1599ms 51ms 107.8MB 3023ms 27ms graal/jvm 17.0.1
java 1.java 1926ms 0.7ms 9.8MB 3787ms 0ms graal/native 21.3.0
go 3.go 3170ms 4.5ms 49.1MB 3143ms 13ms tinygo 0.21.0

Input: 10

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 3.go 125ms 2.7ms 4.8MB 183ms 0ms go 1.17.3
java 1.java 182ms 18ms 9.6MB 320ms 3ms graal/native 21.3.0
java 1.java 213ms 2.8ms 38.0MB 333ms 7ms openjdk 17.0.1
java 1.java 214ms 8.0ms 39.2MB 327ms 13ms openjdk/parallelgc 17.0.1
java 1.java 232ms 2.7ms 36.9MB 360ms 10ms openjdk 18
java 1.java 271ms 8.6ms 38.2MB 350ms 57ms openjdk/zgc 17.0.1
go 3.go 348ms 0.9ms 48.6MB 323ms 10ms tinygo 0.21.0
java 1.java 580ms 36ms 90.3MB 427ms 27ms graal/jvm 17.0.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
java 4.java 475ms 16ms 5.8MB 397ms 13ms graal/native 21.3.0
java 4.java 492ms 12ms 38.3MB 450ms 20ms openjdk 17.0.1
go 3.go 509ms 29ms 2.8MB 400ms 23ms go 1.17.3
java 4.java 522ms 6.6ms 38.5MB 473ms 7ms openjdk/parallelgc 17.0.1
java 4.java 535ms 38ms 36.6MB 463ms 23ms openjdk 18
java 4.java 570ms 3.1ms 37.1MB 477ms 70ms openjdk/zgc 17.0.1
java 4.java 990ms 45ms 168.2MB 780ms 77ms graal/jvm 17.0.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 3.go 51ms 4.2ms 3.3MB 40ms 0ms go 1.17.3
java 4.java 54ms 14ms 5.8MB 33ms 0ms graal/native 21.3.0
java 4.java 118ms 9.4ms 36.6MB 113ms 13ms openjdk 18
java 4.java 120ms 9.3ms 37.4MB 100ms 17ms openjdk 17.0.1
java 4.java 122ms 2.2ms 36.9MB 120ms 13ms openjdk/parallelgc 17.0.1
java 4.java 166ms 1.8ms 36.1MB 123ms 57ms openjdk/zgc 17.0.1
java 4.java 480ms 8.0ms 88.1MB 200ms 33ms graal/jvm 17.0.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 1.4ms 0.3ms 0.2MB 0ms 0ms tinygo 0.21.0
go 1.go 3.3ms 2.1ms 2.7MB 0ms 0ms go 1.17.3
java 1.java 8.0ms 11ms 6.1MB 0ms 0ms graal/native 21.3.0
java 1.java 48ms 1.9ms 34.6MB 28ms 8ms openjdk 17.0.1
java 1.java 50ms 1.5ms 36.4MB 30ms 10ms loom 18
java 1.java 52ms 3.5ms 33.2MB 26ms 14ms openjdk 18
java 1.java 55ms 1.5ms 35.1MB 42ms 10ms openjdk/parallelgc 17.0.1
java 1.java 73ms 3.4ms 52.6MB 70ms 10ms graal/jvm 17.0.1
java 1.java 104ms 1.7ms 36.2MB 40ms 60ms openjdk/zgc 17.0.1

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 746ms 84ms 167.5MB 797ms 437ms go 1.17.3

Input: 500

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 153ms 7.6ms 40.5MB 93ms 77ms go 1.17.3

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 181ms 8.8ms 18.6MB 163ms 3ms go 1.17.3

Input: canada 15

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 1041ms 4.3ms 116.7MB 1013ms 50ms go 1.17.3

mandelbrot

Input: 8000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
java 4.java 2058ms 8.0ms 50.3MB 3927ms 23ms openjdk 17.0.1
java 4.java 2062ms 8.5ms 50.7MB 3950ms 7ms openjdk 18
java 4.java 2070ms 12ms 50.0MB 3960ms 17ms openjdk/parallelgc 17.0.1
java 4.java 2116ms 4.9ms 16.1MB 4097ms 0ms graal/native 21.3.0
java 4.java 2140ms 6.3ms 50.1MB 3977ms 67ms openjdk/zgc 17.0.1
go 1.go 2213ms 3.9ms 11.8MB 4333ms 0ms go 1.17.3
java 4.java 2248ms 16ms 129.0MB 4270ms 43ms graal/jvm 17.0.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 43ms 2.4ms 3.5MB 70ms 0ms go 1.17.3
java 4.java 53ms 26ms 11.0MB 60ms 0ms graal/native 21.3.0
java 4.java 157ms 11ms 41.6MB 213ms 3ms openjdk 18
java 4.java 160ms 6.0ms 42.5MB 200ms 13ms openjdk/parallelgc 17.0.1
java 4.java 161ms 7.8ms 42.0MB 213ms 10ms openjdk 17.0.1
java 4.java 208ms 5.4ms 40.3MB 223ms 60ms openjdk/zgc 17.0.1
java 4.java 522ms 14ms 96.5MB 280ms 43ms graal/jvm 17.0.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 509ms 0.9ms 0.0MB 500ms 0ms tinygo 0.21.0
go 1.go 528ms 1.6ms 2.8MB 517ms 0ms go 1.17.3
java 1.java 586ms 1.1ms 9.4MB 577ms 0ms graal/native 21.3.0
java 1.java 648ms 1.5ms 37.2MB 647ms 13ms openjdk/parallelgc 17.0.1
java 1.java 652ms 2.3ms 39.0MB 647ms 10ms openjdk 18
java 1.java 654ms 1.8ms 38.4MB 643ms 17ms openjdk 17.0.1
java 1.java 732ms 7.0ms 38.0MB 690ms 57ms openjdk/zgc 17.0.1
java 1.java 977ms 11ms 84.0MB 697ms 33ms graal/jvm 17.0.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 52ms 0.8ms 0.0MB 43ms 0ms tinygo 0.21.0
go 1.go 57ms 0.7ms 2.8MB 50ms 0ms go 1.17.3
java 1.java 62ms 0.3ms 9.4MB 50ms 0ms graal/native 21.3.0
java 1.java 124ms 1.1ms 38.7MB 120ms 10ms openjdk 17.0.1
java 1.java 126ms 1.4ms 37.4MB 113ms 17ms openjdk 18
java 1.java 134ms 0.7ms 37.1MB 130ms 13ms openjdk/parallelgc 17.0.1
java 1.java 190ms 8.2ms 38.0MB 143ms 60ms openjdk/zgc 17.0.1
java 1.java 468ms 0.4ms 85.3MB 203ms 23ms graal/jvm 17.0.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 12ms 1.0ms 2.0MB 0ms 0ms tinygo 0.21.0
go 1.go 14ms 2.6ms 2.8MB 10ms 0ms go 1.17.3
java 1.java 26ms 19ms 9.4MB 10ms 0ms graal/native 21.3.0
java 1.java 78ms 3.5ms 38.8MB 70ms 13ms openjdk 17.0.1
java 1.java 81ms 3.7ms 37.4MB 70ms 13ms openjdk 18
java 1.java 88ms 1.3ms 37.2MB 83ms 13ms openjdk/parallelgc 17.0.1
java 1.java 137ms 3.3ms 39.9MB 93ms 53ms openjdk/zgc 17.0.1
java 1.java 421ms 6.4ms 69.5MB 120ms 23ms graal/jvm 17.0.1

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 2.go 675ms 3.8ms 17.6MB 660ms 0ms tinygo 0.21.0
go 1.go 844ms 9.5ms 73.4MB 813ms 20ms go 1.17.3
go 1.go 881ms 14ms 43.1MB 857ms 7ms tinygo 0.21.0
go 2.go 971ms 0.4ms 22.3MB 963ms 3ms go 1.17.3
java 2.java 3623ms 4.9ms 48.9MB 3630ms 17ms openjdk 17.0.1
java 2.java 3703ms 37ms 45.7MB 3720ms 13ms openjdk/parallelgc 17.0.1
java 2.java 3776ms 4.6ms 47.8MB 3797ms 10ms openjdk 18
java 2.java 4081ms 120ms 44.9MB 4047ms 60ms openjdk/zgc 17.0.1

Input: 10

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 1.go 117ms 1.5ms 21.7MB 100ms 3ms go 1.17.3
go 1.go 133ms 0.7ms 13.6MB 120ms 0ms tinygo 0.21.0
go 2.go 157ms 0.6ms 5.6MB 150ms 0ms tinygo 0.21.0
go 2.go 231ms 5.4ms 7.6MB 217ms 0ms go 1.17.3
java 1.java 665ms 5.3ms 58.0MB 670ms 10ms openjdk 17.0.1
java 1.java 706ms 18ms 55.7MB 703ms 20ms openjdk/parallelgc 17.0.1
java 2.java 790ms 1.1ms 42.7MB 803ms 13ms openjdk 17.0.1
java 2.java 794ms 4.4ms 39.7MB 817ms 7ms openjdk/parallelgc 17.0.1
java 1.java 822ms 3.4ms 56.8MB 767ms 77ms openjdk/zgc 17.0.1
java 2.java 830ms 4.1ms 41.8MB 833ms 20ms openjdk 18
java 2.java 885ms 1.6ms 42.2MB 857ms 57ms openjdk/zgc 17.0.1
java 1.java 998ms 2.2ms 56.0MB 1000ms 23ms openjdk 18
java 1.java 1058ms 18ms 23.2MB 1037ms 0ms graal/native 21.3.0
java 1.java 1093ms 4.6ms 240.4MB 1497ms 97ms graal/jvm 17.0.1
java 2.java 1390ms 15ms 8.9MB 1367ms 3ms graal/native 21.3.0
java 2.java 1554ms 49ms 327.9MB 2717ms 150ms graal/jvm 17.0.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 8.go 1254ms 0.8ms 8.5MB 1243ms 0ms go 1.17.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 8.go 297ms 0.4ms 8.5MB 290ms 0ms go 1.17.3
java 1.java 1619ms 86ms 209.4MB 1733ms 93ms openjdk 18
java 1.java 1633ms 57ms 628.4MB 1580ms 177ms openjdk/parallelgc 17.0.1
java 1.java 1684ms 44ms 172.0MB 1700ms 97ms openjdk 17.0.1
java 1.java 1763ms 42ms 434.4MB 1813ms 183ms graal/jvm 17.0.1
java 1.java 2002ms 26ms 263.0MB 1823ms 140ms graal/native 21.3.0
java 1.java 2237ms 31ms 1074.3MB 1753ms 667ms openjdk/zgc 17.0.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 8.go 26ms 3.8ms 8.3MB 13ms 0ms go 1.17.3
java 1.java 210ms 7.9ms 157.0MB 93ms 73ms graal/native 21.3.0
java 1.java 291ms 55ms 106.0MB 297ms 43ms openjdk 18
java 1.java 318ms 30ms 99.7MB 350ms 33ms openjdk/parallelgc 17.0.1
java 1.java 394ms 20ms 190.4MB 327ms 153ms openjdk/zgc 17.0.1
java 1.java 406ms 48ms 109.3MB 410ms 40ms openjdk 17.0.1
java 1.java 710ms 3.4ms 218.8MB 390ms 77ms graal/jvm 17.0.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 4.go 2237ms 3.5ms 4.8MB 4297ms 3ms go 1.17.3
java 2.java 3254ms 24ms 39.7MB 6273ms 20ms openjdk/parallelgc 17.0.1
java 2.java 4349ms 9.1ms 107.1MB 8373ms 57ms graal/jvm 17.0.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 4.go 583ms 7.2ms 4.8MB 1070ms 0ms go 1.17.3
java 2.java 906ms 4.3ms 42.0MB 1677ms 20ms openjdk/parallelgc 17.0.1
java 2.java 1262ms 17ms 104.2MB 2297ms 37ms graal/jvm 17.0.1
java 2.java 1411ms 19ms 40.2MB 2570ms 70ms openjdk/zgc 17.0.1
java 2.java 1468ms 26ms 38.4MB 2777ms 13ms openjdk 17.0.1
java 2.java 2038ms 129ms 37.4MB 3900ms 10ms openjdk 18
java 2.java 2917ms 116ms 10.0MB 5577ms 0ms graal/native 21.3.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(kernel) compiler compiler/runtime
go 4.go 52ms 4.9ms 4.8MB 63ms 0ms go 1.17.3
java 2.java 163ms 12ms 39.5MB 220ms 17ms openjdk/parallelgc 17.0.1
java 2.java 198ms 15ms 9.7MB 340ms 0ms graal/native 21.3.0
java 2.java 200ms 6.8ms 38.8MB 283ms 13ms openjdk 17.0.1
java 2.java 229ms 4.2ms 37.1MB 350ms 7ms openjdk 18
java 2.java 255ms 18ms 38.4MB 300ms 60ms openjdk/zgc 17.0.1
go 4.go 420ms 3.4ms 0.3MB 410ms 0ms tinygo 0.21.0
java 2.java 518ms 19ms 90.2MB 280ms 37ms graal/jvm 17.0.1