Java VS Julia benchmarks

Current benchmark data was generated on Sun Jan 29 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 665ms 13ms 411.6MB 690ms 77ms openjdk 20
java 2.java 706ms 38ms 602.6MB 703ms 100ms openjdk 19
java 2.java 758ms 74ms 666.2MB 807ms 170ms graal/jvm 17.0.6
julia 4.jl 1112ms 26ms 239.5MB 1023ms 163ms julia 1.8.5
java 2.java 1295ms 55ms 1100.1MB 897ms 600ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 166ms 1.5ms 166.6MB 200ms 53ms graal/jvm 17.0.6
java 2.java 169ms 16ms 108.1MB 167ms 23ms openjdk 20
java 2.java 175ms 15ms 110.8MB 190ms 13ms openjdk 19
julia 4.jl 304ms 1.4ms 221.2MB 263ms 120ms julia 1.8.5
java 2.java 305ms 2.4ms 237.9MB 167ms 160ms openjdk/zgc 19

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 776ms 9.5ms 203.7MB 1363ms 53ms openjdk 19
java 1-m.java 826ms 60ms 308.0MB 1477ms 63ms graal/jvm 17.0.6
java 1-m.java 827ms 80ms 206.6MB 1463ms 67ms openjdk 20
java 1-m.java 1003ms 12ms 436.3MB 1523ms 270ms openjdk/zgc 19

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 397ms 38ms 189.7MB 653ms 47ms graal/jvm 17.0.6
java 1-m.java 425ms 35ms 115.5MB 697ms 50ms openjdk 20
java 1-m.java 444ms 27ms 117.7MB 733ms 33ms openjdk 19
java 1-m.java 520ms 3.6ms 209.2MB 740ms 130ms openjdk/zgc 19

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 1661ms 28ms 94.9MB 3153ms 27ms graal/jvm 17.0.6
java 1-m.java 1722ms 52ms 42.1MB 3217ms 53ms openjdk/zgc 19
java 1-m.java 1724ms 16ms 40.7MB 3307ms 10ms openjdk 20
java 1-m.java 1770ms 156ms 43.2MB 3267ms 13ms openjdk 19
julia 2-m.jl 1775ms 12ms 210.1MB 3120ms 127ms julia 1.8.5

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 275ms 2.4ms 40.7MB 453ms 10ms openjdk 20
java 1-m.java 276ms 5.6ms 41.9MB 443ms 13ms openjdk 19
java 1-m.java 289ms 11ms 92.7MB 460ms 27ms graal/jvm 17.0.6
java 1-m.java 327ms 0.8ms 43.8MB 437ms 57ms openjdk/zgc 19
julia 2-m.jl 527ms 5.9ms 209.8MB 693ms 117ms julia 1.8.5

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 517ms 6.4ms 40.5MB 580ms 17ms openjdk 20
java 4.java 520ms 2.8ms 43.5MB 600ms 7ms openjdk 19
java 4.java 561ms 7.6ms 41.9MB 587ms 53ms openjdk/zgc 19
julia 7-m.jl 630ms 2.1ms 291.8MB 860ms 147ms julia 1.8.5
java 4.java 633ms 35ms 97.1MB 800ms 20ms graal/jvm 17.0.6

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 147ms 6.6ms 41.1MB 170ms 10ms openjdk 19
java 4.java 151ms 6.2ms 86.0MB 173ms 20ms graal/jvm 17.0.6
java 4.java 153ms 4.2ms 39.7MB 177ms 7ms openjdk 20
java 4.java 198ms 6.1ms 41.3MB 180ms 43ms openjdk/zgc 19
julia 7-m.jl 451ms 0.5ms 226.0MB 563ms 117ms julia 1.8.5

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 73ms 5.0ms 69.5MB 72ms 10ms graal/jvm 17.0.6
java 1.java 79ms 5.0ms 39.2MB 72ms 10ms openjdk 20
java 1.java 81ms 6.4ms 41.7MB 80ms 4ms openjdk 19
java 1.java 118ms 0.9ms 40.0MB 76ms 48ms openjdk/zgc 19
julia 1.jl 179ms 0.4ms 163.9MB 114ms 70ms julia/aot 1.8.5
julia 1.jl 194ms 1.8ms 171.2MB 132ms 76ms julia 1.8.5

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 8.jl 1118ms 9.1ms 273.3MB 1470ms 157ms julia 1.8.5
java 3-m.java 1430ms 19ms 115.1MB 2607ms 33ms openjdk 20
java 3-m.java 1469ms 22ms 115.8MB 2673ms 37ms openjdk 19
java 3-m.java 1527ms 56ms 169.6MB 2787ms 50ms graal/jvm 17.0.6
java 3-m.java 1925ms 14ms 173.7MB 3393ms 130ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3-m.java 466ms 17ms 137.1MB 790ms 30ms graal/jvm 17.0.6
java 3-m.java 500ms 58ms 91.1MB 820ms 43ms openjdk 20
java 3-m.java 508ms 27ms 97.9MB 773ms 73ms openjdk/zgc 19
java 3-m.java 528ms 32ms 98.6MB 893ms 30ms openjdk 19
julia 8.jl 763ms 4.0ms 259.1MB 847ms 143ms julia 1.8.5

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1b.java 1411ms 6.3ms 50.0MB 1487ms 17ms openjdk 19
java 1b.java 1411ms 9.8ms 47.0MB 1490ms 10ms openjdk 20
java 1b.java 1463ms 1.9ms 108.5MB 1690ms 20ms graal/jvm 17.0.6
java 1b.java 1465ms 11ms 47.5MB 1510ms 53ms openjdk/zgc 19
java 1a.java 1532ms 4.3ms 50.0MB 1600ms 13ms openjdk 19
java 1a.java 1540ms 7.7ms 47.7MB 1613ms 20ms openjdk 20
java 1a.java 1572ms 5.7ms 99.4MB 1660ms 20ms graal/jvm 17.0.6
java 1a.java 1583ms 7.3ms 47.7MB 1617ms 53ms openjdk/zgc 19
java 1.java 2016ms 6.4ms 129.9MB 2083ms 47ms graal/jvm 17.0.6
java 1.java 2115ms 6.1ms 220.8MB 2157ms 40ms openjdk 20
java 1.java 2136ms 0.6ms 195.4MB 2173ms 40ms openjdk 19
java 1.java 2511ms 6.1ms 579.7MB 2250ms 370ms openjdk/zgc 19
java 2.java timeout 0.0ms 505.0MB 5157ms 123ms openjdk 19
java 2.java timeout 0.0ms 579.5MB 5180ms 117ms openjdk 20
java 2.java timeout 0.0ms 1251.1MB 4837ms 623ms openjdk/zgc 19

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1b.java 213ms 12ms 47.7MB 283ms 17ms openjdk 19
java 1b.java 214ms 1.6ms 43.4MB 293ms 13ms openjdk 20
java 1.java 220ms 2.8ms 97.6MB 273ms 23ms openjdk 19
java 1a.java 223ms 16ms 43.6MB 297ms 17ms openjdk 20
java 1a.java 224ms 14ms 49.4MB 283ms 27ms openjdk 19
java 1a.java 227ms 11ms 97.6MB 280ms 33ms graal/jvm 17.0.6
java 1.java 235ms 3.4ms 102.1MB 310ms 20ms graal/jvm 17.0.6
java 1.java 237ms 24ms 95.4MB 307ms 17ms openjdk 20
java 1b-m.java 246ms 4.6ms 95.8MB 350ms 33ms graal/jvm 17.0.6
java 1a.java 266ms 13ms 46.7MB 290ms 57ms openjdk/zgc 19
java 1b.java 269ms 11ms 45.4MB 290ms 53ms openjdk/zgc 19
java 1.java 298ms 24ms 111.8MB 317ms 77ms openjdk/zgc 19
java 2.java 755ms 13ms 515.4MB 927ms 120ms openjdk 19
java 2.java 779ms 14ms 557.2MB 973ms 107ms openjdk 20
java 2.java 1364ms 19ms 1024.4MB 1030ms 617ms openjdk/zgc 19

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 497ms 8.7ms 292.4MB 520ms 63ms openjdk 19
java 1.java 528ms 28ms 370.9MB 540ms 77ms openjdk 20
java 1.java 538ms 2.0ms 353.6MB 657ms 83ms graal/jvm 17.0.6
java 1.java 975ms 42ms 771.3MB 650ms 453ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 224ms 6.8ms 174.4MB 240ms 30ms openjdk 19
java 1.java 228ms 10ms 221.4MB 240ms 47ms openjdk 20
java 1-m.java 269ms 27ms 281.9MB 350ms 60ms graal/jvm 17.0.6
java 1.java 428ms 3.0ms 354.6MB 277ms 207ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 7.jl 549ms 0.1ms 168.6MB 507ms 120ms julia/aot 1.8.5
java 1.java 552ms 11ms 91.5MB 587ms 23ms graal/jvm 17.0.6
java 1.java 568ms 4.1ms 41.7MB 570ms 20ms openjdk 20
java 1.java 569ms 3.5ms 42.5MB 583ms 13ms openjdk 19
java 1.java 613ms 4.2ms 41.7MB 590ms 43ms openjdk/zgc 19
julia 7.jl 709ms 1.2ms 224.5MB 663ms 120ms julia 1.8.5
java 2.java 1893ms 20ms 560.5MB 1923ms 103ms openjdk 20
java 2.java 1917ms 37ms 504.3MB 1953ms 110ms openjdk 19
java 2.java 2583ms 5.9ms 1215.9MB 2013ms 753ms openjdk/zgc 19

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 141ms 2.6ms 88.3MB 177ms 20ms graal/jvm 17.0.6
java 1.java 150ms 5.2ms 40.8MB 160ms 7ms openjdk 20
java 1.java 151ms 5.1ms 42.6MB 167ms 10ms openjdk 19
java 1.java 188ms 3.2ms 44.0MB 160ms 47ms openjdk/zgc 19
julia 7.jl 246ms 3.3ms 169.8MB 210ms 100ms julia/aot 1.8.5
julia 7.jl 395ms 6.8ms 223.7MB 333ms 133ms julia 1.8.5
java 2.java 416ms 24ms 323.9MB 487ms 63ms openjdk 19
java 2.java 423ms 14ms 292.4MB 500ms 60ms openjdk 20
java 2.java 710ms 38ms 521.9MB 533ms 323ms openjdk/zgc 19

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 1.jl 423ms 0.6ms 156.3MB 390ms 113ms julia/aot 1.8.5
julia 1.jl 528ms 2.4ms 203.3MB 487ms 113ms julia 1.8.5
java 1.java 727ms 58ms 84.4MB 750ms 20ms openjdk 19
java 1.java 731ms 58ms 82.8MB 750ms 17ms openjdk 20
java 1.java 886ms 17ms 110.3MB 833ms 87ms openjdk/zgc 19
java 2.java 1006ms 4.8ms 50.4MB 1030ms 17ms openjdk 20
java 2.java 1027ms 10ms 50.6MB 1007ms 53ms openjdk/zgc 19
java 2.java 1031ms 14ms 54.2MB 1053ms 13ms openjdk 19
java 1-m.java 1154ms 57ms 242.5MB 1697ms 77ms graal/jvm 17.0.6
java 2-m.java 1762ms 128ms 223.2MB 3120ms 73ms graal/jvm 17.0.6

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 1.jl 220ms 2.5ms 150.2MB 177ms 87ms julia/aot 1.8.5
java 1.java 236ms 3.4ms 58.8MB 260ms 10ms openjdk 20
java 1.java 244ms 7.4ms 61.9MB 263ms 13ms openjdk 19
java 1.java 281ms 6.3ms 60.8MB 263ms 50ms openjdk/zgc 19
julia 1.jl 326ms 1.7ms 195.1MB 293ms 113ms julia 1.8.5
java 2.java 326ms 2.4ms 44.5MB 360ms 17ms openjdk 20
java 2.java 329ms 2.4ms 48.2MB 360ms 10ms openjdk 19
java 1-m.java 335ms 11ms 143.4MB 473ms 33ms graal/jvm 17.0.6
java 2.java 359ms 9.8ms 46.0MB 347ms 50ms openjdk/zgc 19
java 2-m.java 621ms 17ms 150.6MB 1090ms 43ms graal/jvm 17.0.6

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 791ms 4.6ms 176.9MB 760ms 103ms julia 1.8.5
julia 1.jl 1373ms 3.2ms 260.8MB 1303ms 147ms julia 1.8.5
java 1.java 4962ms 11ms 314.2MB 5410ms 93ms graal/jvm 17.0.6
java 1.java timeout 0.0ms 270.3MB 5407ms 73ms openjdk 19
java 1.java timeout 0.0ms 292.5MB 5443ms 83ms openjdk 20
java 1.java timeout 0.0ms 1158.3MB 5100ms 633ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 3.jl 342ms 0.3ms 176.2MB 307ms 113ms julia 1.8.5
julia 1.jl 780ms 23ms 261.5MB 710ms 133ms julia 1.8.5
java 1.java 1325ms 8.7ms 299.0MB 1697ms 70ms graal/jvm 17.0.6
java 1.java 1420ms 34ms 251.1MB 1793ms 63ms openjdk 19
java 1.java 1426ms 20ms 256.2MB 1757ms 70ms openjdk 20
java 1.java 1990ms 61ms 1047.5MB 1943ms 610ms openjdk/zgc 19

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3.java timeout 0.0ms 253.5MB 5323ms 57ms graal/jvm 17.0.6
java 3.java timeout 0.0ms 206.1MB 5260ms 43ms openjdk 19
java 3.java timeout 0.0ms 203.8MB 5247ms 57ms openjdk 20
java 3.java timeout 0.0ms 334.4MB 4980ms 213ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3.java 1040ms 26ms 168.9MB 1447ms 40ms graal/jvm 17.0.6
java 3.java 1058ms 15ms 111.4MB 1373ms 33ms openjdk 19
java 3.java 1068ms 20ms 112.1MB 1393ms 30ms openjdk 20
java 3.java 1177ms 15ms 158.8MB 1350ms 117ms openjdk/zgc 19

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 2-m.jl 1370ms 7.3ms 192.9MB 2410ms 103ms julia 1.8.5
julia 3-m.jl 2107ms 0.8ms 211.4MB 3787ms 123ms julia 1.8.5
java 2-m.java 4292ms 31ms 91.3MB 8270ms 37ms graal/jvm 17.0.6
java 2.java timeout 0.0ms 43.8MB 9717ms 17ms openjdk 19
java 2.java timeout 0.0ms 40.4MB 9713ms 13ms openjdk 20
java 2.java timeout 0.0ms 43.7MB 9647ms 43ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 2-m.jl 578ms 0.1ms 192.5MB 853ms 110ms julia 1.8.5
julia 3-m.jl 804ms 1.2ms 210.3MB 1233ms 120ms julia 1.8.5
java 2-m.java 1230ms 14ms 92.6MB 2260ms 30ms graal/jvm 17.0.6
java 2-m.java 1659ms 48ms 42.4MB 3133ms 10ms openjdk 19
java 2-m.java 1774ms 175ms 43.5MB 3273ms 53ms openjdk/zgc 19
java 2-m.java 1973ms 14ms 40.9MB 3773ms 10ms openjdk 20

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
julia 2-m.jl 381ms 2.7ms 192.3MB 467ms 113ms julia 1.8.5
java 2-m.java 432ms 15ms 91.2MB 733ms 20ms graal/jvm 17.0.6
julia 3.jl 477ms 5.1ms 211.5MB 577ms 137ms julia 1.8.5
java 2-m.java 579ms 39ms 42.3MB 1013ms 13ms openjdk 19
java 2-m.java 580ms 26ms 40.9MB 1030ms 13ms openjdk 20
java 2-m.java 626ms 51ms 43.4MB 1030ms 50ms openjdk/zgc 19

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 3207ms 69ms 170.5MB 6133ms 77ms openjdk 19
java 1-m.java 4183ms 84ms 919.6MB 7500ms 457ms openjdk/zgc 19
java 1.java timeout 0.0ms 142.8MB 9383ms 83ms openjdk 20

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 738ms 62ms 119.3MB 1300ms 27ms openjdk 19
java 1-m.java 846ms 120ms 113.1MB 1533ms 37ms openjdk 20
java 1-m.java 967ms 96ms 317.6MB 1563ms 157ms openjdk/zgc 19