Dart VS Java benchmarks

Current benchmark data was generated on Fri Sep 30 2022, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (Model 85)

* -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 766ms 12ms 414.2MB 733ms 123ms openjdk 20
java 2.java 785ms 6.1ms 409.0MB 753ms 127ms openjdk 19
java 2.java 804ms 24ms 683.4MB 853ms 203ms graal/jvm 17.0.4
dart 1.dart 1265ms 11ms 87.3MB 1240ms 37ms dart/exe 2.18.2
java 2.java 1479ms 49ms 1081.8MB 1013ms 687ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 115ms 2.2ms 47.2MB 87ms 17ms dart/exe 2.18.2
java 2.java 179ms 6.1ms 109.2MB 173ms 30ms openjdk 19
java 2.java 185ms 15ms 110.9MB 183ms 27ms openjdk 20
java 2.java 210ms 21ms 165.1MB 253ms 43ms graal/jvm 17.0.4
java 2.java 345ms 11ms 240.4MB 183ms 193ms 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 3298ms 52ms 201.3MB 6173ms 120ms openjdk 19
java 1-m.java 4199ms 57ms 944.9MB 7373ms 620ms openjdk/zgc 19
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.18.2
java 1.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 20

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 567ms 1.3ms 15.1MB 553ms 17ms dart/exe 2.18.2
java 1-m.java 715ms 68ms 112.9MB 1240ms 53ms openjdk 19
java 1-m.java 816ms 116ms 107.2MB 1427ms 53ms openjdk 20
java 1-m.java 977ms 78ms 302.2MB 1567ms 190ms openjdk/zgc 19

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 817ms 50ms 281.2MB 1387ms 120ms graal/jvm 17.0.4
java 1-m.java 822ms 47ms 207.2MB 1430ms 70ms openjdk 19
java 1-m.java 823ms 67ms 221.6MB 1443ms 67ms openjdk 20
java 1-m.java 1036ms 18ms 422.0MB 1453ms 337ms openjdk/zgc 19
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.18.2

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 420ms 13ms 189.2MB 647ms 90ms graal/jvm 17.0.4
java 1-m.java 445ms 7.5ms 116.4MB 717ms 50ms openjdk 19
java 1-m.java 451ms 8.9ms 119.1MB 730ms 53ms openjdk 20
java 1-m.java 565ms 25ms 208.9MB 750ms 180ms openjdk/zgc 19
dart 1.dart 1733ms 4.0ms 17.7MB 1727ms 10ms dart/exe 2.18.2

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 1418ms 8.8ms 91.7MB 2653ms 37ms graal/jvm 17.0.4
java 1-m.java 1579ms 40ms 42.2MB 2890ms 80ms openjdk/zgc 19
java 1-m.java 1582ms 75ms 42.1MB 3000ms 13ms openjdk 19
java 1-m.java 1585ms 94ms 44.3MB 3030ms 20ms openjdk 20
dart 2.dart 4574ms 1.9ms 11.8MB 4557ms 3ms dart/exe 2.18.2

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 263ms 5.7ms 42.2MB 420ms 10ms openjdk 19
java 1-m.java 264ms 8.7ms 44.1MB 410ms 23ms openjdk 20
java 1-m.java 292ms 38ms 100.0MB 440ms 37ms graal/jvm 17.0.4
java 1-m.java 317ms 7.1ms 44.0MB 403ms 77ms openjdk/zgc 19
dart 2.dart 368ms 0.6ms 14.3MB 353ms 0ms dart/exe 2.18.2

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 466ms 12ms 41.7MB 540ms 17ms openjdk 19
java 4.java 470ms 6.4ms 43.9MB 547ms 13ms openjdk 20
dart 1.dart 490ms 0.9ms 14.4MB 473ms 0ms dart/exe 2.18.2
java 4.java 526ms 14ms 43.5MB 547ms 70ms openjdk/zgc 19
java 4-m.java 549ms 6.3ms 118.4MB 850ms 47ms graal/jvm 17.0.4

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 59ms 0.4ms 16.2MB 43ms 3ms dart/exe 2.18.2
java 4.java 142ms 2.0ms 41.3MB 160ms 10ms openjdk 19
java 4.java 142ms 1.7ms 42.9MB 157ms 20ms openjdk 20
java 4.java 156ms 7.9ms 82.9MB 173ms 37ms graal/jvm 17.0.4
java 4.java 201ms 3.0ms 41.3MB 170ms 63ms openjdk/zgc 19

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 77ms 2.0ms 58.0MB 70ms 14ms graal/jvm 17.0.4
java 1.java 83ms 3.5ms 40.6MB 80ms 10ms openjdk 20
java 1.java 89ms 4.9ms 40.5MB 78ms 10ms openjdk 19
java 1.java 136ms 2.5ms 39.9MB 80ms 68ms openjdk/zgc 19
dart 1.dart 409ms 547ms 11.2MB 0ms 0ms dart/exe 2.18.2

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1732ms 420ms 119.5MB 1370ms 873ms dart/exe 2.18.2
dart 1.dart 3933ms 61ms 104.4MB 1283ms 737ms dart/exe 2.18.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 279ms 14ms 56.0MB 187ms 147ms dart/exe 2.18.2
dart 1.dart 1505ms 133ms 55.3MB 193ms 117ms dart/exe 2.18.2

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 280ms 0.2ms 59.9MB 250ms 20ms dart/exe 2.18.2

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 2235ms 3.2ms 298.4MB 2273ms 160ms dart/exe 2.18.2

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3-m.java 1499ms 3.9ms 116.2MB 2733ms 37ms openjdk 19
java 3-m.java 1513ms 13ms 114.9MB 2747ms 47ms openjdk 20
java 3-m.java 1537ms 13ms 192.2MB 2767ms 93ms graal/jvm 17.0.4
java 3-m.java 2015ms 5.0ms 174.5MB 3473ms 177ms openjdk/zgc 19
dart 3-m.dart 2787ms 88ms 255.8MB 4943ms 133ms dart/exe 2.18.2

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3-m.java 429ms 5.9ms 92.9MB 690ms 33ms openjdk 20
dart 3-m.dart 440ms 24ms 196.6MB 693ms 87ms dart/exe 2.18.2
java 3-m.java 503ms 8.8ms 94.1MB 727ms 100ms openjdk/zgc 19
java 3-m.java 508ms 64ms 96.7MB 820ms 50ms openjdk 19
java 3-m.java 739ms 144ms 179.8MB 1260ms 90ms graal/jvm 17.0.4

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 213ms 2.2ms 14.7MB 197ms 0ms dart/exe 2.18.2
dart 1.dart 992ms 2.6ms 16.6MB 973ms 3ms dart/exe 2.18.2

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 613ms 2.5ms 14.6MB 603ms 3ms dart/exe 2.18.2
dart 1.dart 2952ms 4.9ms 16.7MB 2947ms 7ms dart/exe 2.18.2

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 101ms 0.6ms 14.5MB 80ms 3ms dart/exe 2.18.2
dart 1.dart 171ms 2.7ms 14.2MB 157ms 0ms dart/exe 2.18.2

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 575ms 8.1ms 294.1MB 597ms 87ms openjdk 20
dart 1.dart 589ms 2.3ms 69.3MB 557ms 37ms dart/exe 2.18.2
java 1.java 600ms 16ms 365.9MB 607ms 97ms openjdk 19
java 1.java 681ms 58ms 366.4MB 847ms 120ms graal/jvm 17.0.4
java 1.java 1088ms 1.8ms 733.5MB 740ms 500ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 140ms 2.3ms 48.8MB 113ms 20ms dart/exe 2.18.2
java 1.java 245ms 3.0ms 174.2MB 243ms 63ms openjdk 19
java 1.java 246ms 3.9ms 173.9MB 263ms 43ms openjdk 20
java 1-m.java 301ms 4.0ms 244.5MB 420ms 77ms graal/jvm 17.0.4
java 1.java 465ms 8.9ms 325.2MB 287ms 230ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 586ms 6.5ms 87.4MB 627ms 30ms graal/jvm 17.0.4
dart 3.dart 618ms 0.2ms 12.0MB 600ms 0ms dart/exe 2.18.2
java 1.java 638ms 5.0ms 44.2MB 647ms 20ms openjdk 19
java 1.java 643ms 3.3ms 42.4MB 650ms 23ms openjdk 20
java 1.java 705ms 4.7ms 42.0MB 663ms 73ms openjdk/zgc 19
java 2.java 2299ms 9.1ms 534.4MB 2290ms 163ms openjdk 20
java 2.java 2309ms 29ms 487.1MB 2310ms 157ms openjdk 19
java 2.java 3386ms 50ms 1654.7MB 2387ms 1197ms openjdk/zgc 19

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 71ms 1.0ms 13.8MB 60ms 0ms dart/exe 2.18.2
java 1.java 157ms 3.9ms 42.3MB 170ms 10ms openjdk 19
java 1.java 157ms 4.7ms 42.7MB 170ms 20ms openjdk 20
java 1.java 157ms 3.0ms 87.9MB 203ms 23ms graal/jvm 17.0.4
java 1.java 214ms 4.5ms 43.5MB 183ms 63ms openjdk/zgc 19
java 2.java 480ms 11ms 354.0MB 527ms 93ms openjdk 20
java 2.java 482ms 9.4ms 345.0MB 523ms 103ms openjdk 19
java 2.java 802ms 2.3ms 484.3MB 590ms 367ms openjdk/zgc 19

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1717ms 2.7ms 20.5MB 1713ms 67ms dart/exe 2.18.2
java 1.java timeout 0.0ms 0.0MB 0ms 0ms graal/jvm 17.0.4
java 1.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 19
java 1.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 20
java 1.java timeout 0.0ms 0.0MB 0ms 0ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 435ms 0.9ms 22.8MB 403ms 40ms dart/exe 2.18.2
java 1.java 1515ms 17ms 317.7MB 1813ms 113ms openjdk 19
java 1.java 1529ms 15ms 309.2MB 1803ms 107ms openjdk 20
java 1.java 1564ms 6.5ms 384.4MB 1910ms 120ms graal/jvm 17.0.4
java 1.java 2102ms 48ms 967.5MB 1730ms 713ms openjdk/zgc 19

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.18.2
java 3.java timeout 0.0ms 0.0MB 0ms 0ms graal/jvm 17.0.4
java 3.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 19
java 3.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 20
java 3.java timeout 0.0ms 0.0MB 0ms 0ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 745ms 5.6ms 56.2MB 713ms 17ms dart/exe 2.18.2
java 3.java 1005ms 4.4ms 109.9MB 1327ms 43ms openjdk 19
java 3.java 1009ms 12ms 113.9MB 1327ms 47ms openjdk 20
java 3.java 1023ms 47ms 189.9MB 1433ms 70ms graal/jvm 17.0.4
java 3.java 1145ms 36ms 159.8MB 1283ms 163ms openjdk/zgc 19

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 4360ms 25ms 107.0MB 8363ms 43ms graal/jvm 17.0.4
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.18.2
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 19
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 20
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1256ms 53ms 103.4MB 2277ms 47ms graal/jvm 17.0.4
dart 1.dart 1314ms 0.9ms 11.9MB 1297ms 0ms dart/exe 2.18.2
java 2-m.java 1633ms 55ms 42.8MB 3080ms 23ms openjdk 20
java 2-m.java 1736ms 112ms 45.0MB 3293ms 10ms openjdk 19
java 2-m.java 1749ms 139ms 42.7MB 3200ms 77ms openjdk/zgc 19

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 338ms 1.7ms 13.9MB 320ms 0ms dart/exe 2.18.2
java 2-m.java 436ms 26ms 100.2MB 727ms 37ms graal/jvm 17.0.4
java 2-m.java 577ms 28ms 44.3MB 1013ms 20ms openjdk 20
java 2-m.java 583ms 8.5ms 43.6MB 1033ms 7ms openjdk 19
java 2-m.java 632ms 24ms 44.2MB 1010ms 77ms openjdk/zgc 19