Dart VS Java benchmarks

Current benchmark data was generated on Sat Jan 28 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 6.1ms 412.0MB 690ms 70ms openjdk 20
java 2.java 719ms 58ms 602.2MB 703ms 117ms openjdk 19
java 2.java 760ms 59ms 667.2MB 823ms 147ms graal/jvm 17.0.6
dart 1.dart 992ms 20ms 87.6MB 960ms 33ms dart/exe 2.19.0
java 2.java 1276ms 25ms 1068.3MB 903ms 577ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 100ms 1.5ms 47.9MB 70ms 17ms dart/exe 2.19.0
java 2.java 167ms 1.7ms 109.0MB 167ms 30ms openjdk 19
java 2.java 169ms 16ms 108.4MB 163ms 20ms openjdk 20
java 2-m.java 172ms 3.9ms 157.8MB 217ms 43ms graal/jvm 17.0.6
java 2.java 295ms 1.6ms 248.7MB 197ms 137ms 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 1079ms 1868ms 169.2MB 8467ms 113ms openjdk 19
java 1-m.java 4163ms 65ms 906.7MB 7423ms 537ms openjdk/zgc 19
dart 1.dart timeout 0.0ms 24.3MB 4900ms 70ms dart/exe 2.19.0
java 1.java timeout 0.0ms 139.7MB 9567ms 47ms openjdk 20

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 553ms 1.9ms 16.2MB 520ms 10ms dart/exe 2.19.0
java 1-m.java 766ms 114ms 112.0MB 1377ms 37ms openjdk 20
java 1-m.java 817ms 154ms 113.2MB 1453ms 47ms openjdk 19
java 1-m.java 950ms 24ms 315.6MB 1520ms 173ms openjdk/zgc 19

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 778ms 13ms 204.8MB 1363ms 63ms openjdk 20
java 1-m.java 846ms 64ms 301.8MB 1367ms 70ms graal/jvm 17.0.6
java 1-m.java 877ms 15ms 199.6MB 1570ms 57ms openjdk 19
java 1-m.java 1013ms 13ms 429.1MB 1507ms 290ms openjdk/zgc 19
dart 1.dart 4938ms 23ms 23.7MB 4900ms 30ms dart/exe 2.19.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 367ms 12ms 159.9MB 603ms 50ms graal/jvm 17.0.6
java 1-m.java 441ms 18ms 118.0MB 737ms 23ms openjdk 19
java 1-m.java 466ms 5.9ms 115.5MB 780ms 40ms openjdk 20
java 1-m.java 550ms 40ms 209.2MB 790ms 137ms openjdk/zgc 19
dart 1.dart 791ms 1.1ms 15.6MB 763ms 10ms dart/exe 2.19.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 1668ms 10ms 95.1MB 3183ms 20ms graal/jvm 17.0.6
java 1-m.java 1741ms 6.4ms 43.8MB 3257ms 50ms openjdk/zgc 19
java 1-m.java 1751ms 36ms 43.7MB 3357ms 20ms openjdk 19
java 1-m.java 1789ms 119ms 41.1MB 3427ms 10ms openjdk 20
dart 2.dart 4057ms 23ms 11.5MB 4040ms 0ms dart/exe 2.19.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 277ms 4.7ms 43.6MB 440ms 20ms openjdk 19
java 1-m.java 278ms 2.5ms 40.5MB 453ms 7ms openjdk 20
java 1-m.java 283ms 4.5ms 90.9MB 463ms 10ms graal/jvm 17.0.6
java 1-m.java 321ms 3.3ms 43.8MB 440ms 57ms openjdk/zgc 19
dart 2.dart 331ms 3.5ms 11.9MB 317ms 0ms dart/exe 2.19.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 515ms 1.8ms 40.7MB 587ms 10ms openjdk 20
java 4.java 523ms 4.9ms 42.2MB 587ms 17ms openjdk 19
java 4.java 561ms 7.1ms 43.3MB 583ms 57ms openjdk/zgc 19
dart 1.dart 565ms 7.2ms 16.6MB 543ms 3ms dart/exe 2.19.0
java 4.java 617ms 8.7ms 99.3MB 793ms 30ms graal/jvm 17.0.6

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 151ms 6.6ms 41.0MB 173ms 10ms openjdk 19
java 4.java 155ms 11ms 89.1MB 203ms 17ms graal/jvm 17.0.6
java 4.java 155ms 5.7ms 40.1MB 183ms 7ms openjdk 20
java 4.java 191ms 4.0ms 41.1MB 167ms 50ms openjdk/zgc 19
dart 1.dart 1065ms 0.6ms 14.0MB 53ms 0ms dart/exe 2.19.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 76ms 6.2ms 63.1MB 70ms 10ms graal/jvm 17.0.6
java 1.java 79ms 3.3ms 39.3MB 74ms 10ms openjdk 20
java 1.java 81ms 3.7ms 41.3MB 76ms 8ms openjdk 19
java 1.java 119ms 4.3ms 39.7MB 76ms 48ms openjdk/zgc 19
dart 1.dart 407ms 548ms 14.0MB 0ms 0ms dart/exe 2.19.0

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1910ms 398ms 117.8MB 963ms 653ms dart/exe 2.19.0
dart 1.dart 3763ms 61ms 106.4MB 967ms 580ms dart/exe 2.19.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 593ms 595ms 56.9MB 173ms 120ms dart/exe 2.19.0
dart 1.dart 1348ms 116ms 55.9MB 140ms 113ms dart/exe 2.19.0

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 264ms 2.2ms 58.7MB 237ms 13ms dart/exe 2.19.0

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 2132ms 3.3ms 302.9MB 2197ms 90ms dart/exe 2.19.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3-m.java 1450ms 24ms 113.3MB 2653ms 33ms openjdk 20
java 3-m.java 1455ms 8.2ms 116.8MB 2667ms 33ms openjdk 19
java 3-m.java 1562ms 78ms 169.4MB 2877ms 47ms graal/jvm 17.0.6
java 3-m.java 1982ms 73ms 174.2MB 3517ms 120ms openjdk/zgc 19
dart 3-m.dart 2503ms 31ms 253.6MB 4190ms 90ms dart/exe 2.19.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3-m.dart 402ms 13ms 196.8MB 620ms 80ms dart/exe 2.19.0
java 3-m.java 444ms 36ms 87.4MB 730ms 30ms openjdk 20
java 3-m.java 473ms 46ms 96.2MB 803ms 27ms openjdk 19
java 3-m.java 487ms 49ms 139.1MB 790ms 50ms graal/jvm 17.0.6
java 3-m.java 490ms 25ms 96.3MB 743ms 87ms openjdk/zgc 19

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 251ms 2.9ms 15.0MB 237ms 0ms dart/exe 2.19.0
dart 1.dart 1462ms 3.8ms 14.4MB 1447ms 0ms dart/exe 2.19.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 743ms 14ms 14.3MB 723ms 3ms dart/exe 2.19.0
dart 1.dart 4365ms 5.6ms 16.5MB 4343ms 0ms dart/exe 2.19.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 118ms 2.0ms 15.0MB 100ms 0ms dart/exe 2.19.0
dart 1.dart 215ms 2.6ms 17.1MB 200ms 0ms dart/exe 2.19.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 487ms 6.4ms 70.7MB 463ms 20ms dart/exe 2.19.0
java 1.java 505ms 22ms 369.4MB 543ms 47ms openjdk 19
java 1.java 534ms 50ms 290.5MB 547ms 53ms openjdk 20
java 1.java 574ms 78ms 352.8MB 723ms 90ms graal/jvm 17.0.6
java 1.java 951ms 43ms 764.9MB 647ms 437ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 126ms 0.9ms 49.1MB 100ms 13ms dart/exe 2.19.0
java 1.java 216ms 5.7ms 173.4MB 240ms 30ms openjdk 19
java 1.java 234ms 11ms 222.3MB 227ms 57ms openjdk 20
java 1-m.java 270ms 4.6ms 281.7MB 367ms 67ms graal/jvm 17.0.6
java 1.java 432ms 11ms 354.8MB 253ms 223ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 528ms 4.1ms 12.1MB 513ms 0ms dart/exe 2.19.0
java 1.java 542ms 2.3ms 88.2MB 563ms 23ms graal/jvm 17.0.6
java 1.java 565ms 6.7ms 40.5MB 563ms 20ms openjdk 20
java 1.java 568ms 4.5ms 44.3MB 573ms 10ms openjdk 19
java 1.java 613ms 5.8ms 41.9MB 580ms 50ms openjdk/zgc 19
java 2.java 1881ms 18ms 552.6MB 1900ms 113ms openjdk 20
java 2.java 1893ms 4.6ms 532.8MB 1910ms 107ms openjdk 19
java 2.java 2574ms 9.2ms 1220.9MB 1993ms 770ms openjdk/zgc 19

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 137ms 1.3ms 86.0MB 163ms 23ms graal/jvm 17.0.6
java 1.java 144ms 3.4ms 42.3MB 157ms 10ms openjdk 19
java 1.java 149ms 7.7ms 40.7MB 160ms 10ms openjdk 20
java 1.java 191ms 2.6ms 44.1MB 160ms 50ms openjdk/zgc 19
java 2.java 414ms 6.8ms 335.1MB 487ms 63ms openjdk 19
java 2.java 416ms 8.0ms 338.5MB 477ms 67ms openjdk 20
java 2.java 701ms 44ms 528.8MB 540ms 313ms openjdk/zgc 19
dart 3.dart 1060ms 0.3ms 13.7MB 50ms 0ms dart/exe 2.19.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1694ms 19ms 21.9MB 1620ms 53ms dart/exe 2.19.0
java 1.java 4919ms 11ms 360.4MB 5340ms 87ms graal/jvm 17.0.6
java 1.java timeout 0.0ms 239.2MB 5423ms 90ms openjdk 19
java 1.java timeout 0.0ms 279.2MB 5390ms 80ms openjdk 20
java 1.java timeout 0.0ms 1254.0MB 5003ms 670ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 424ms 7.3ms 19.8MB 383ms 27ms dart/exe 2.19.0
java 1.java 1341ms 31ms 311.6MB 1660ms 80ms graal/jvm 17.0.6
java 1.java 1424ms 19ms 274.6MB 1790ms 63ms openjdk 19
java 1.java 1452ms 11ms 294.2MB 1840ms 70ms openjdk 20
java 1.java 1943ms 14ms 917.6MB 1850ms 570ms 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 102.4MB 4957ms 23ms dart/exe 2.19.0
java 3.java timeout 0.0ms 251.6MB 5297ms 53ms graal/jvm 17.0.6
java 3.java timeout 0.0ms 205.8MB 5240ms 70ms openjdk 19
java 3.java timeout 0.0ms 204.2MB 5250ms 63ms openjdk 20
java 3.java timeout 0.0ms 337.4MB 4960ms 220ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 785ms 3.3ms 54.1MB 757ms 10ms dart/exe 2.19.0
java 3.java 1031ms 22ms 171.4MB 1417ms 47ms graal/jvm 17.0.6
java 3.java 1061ms 34ms 109.9MB 1380ms 37ms openjdk 19
java 3.java 1064ms 6.8ms 114.5MB 1403ms 27ms openjdk 20
java 3.java 1191ms 24ms 157.7MB 1353ms 120ms 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 4207ms 116ms 89.8MB 8140ms 20ms graal/jvm 17.0.6
dart 1.dart timeout 0.0ms 11.9MB 4990ms 0ms dart/exe 2.19.0
java 2.java timeout 0.0ms 46.0MB 9730ms 17ms openjdk 19
java 2.java timeout 0.0ms 40.7MB 9717ms 13ms openjdk 20
java 2.java timeout 0.0ms 41.8MB 9627ms 43ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1208ms 43ms 91.2MB 2237ms 27ms graal/jvm 17.0.6
dart 1.dart 1293ms 3.0ms 13.8MB 1270ms 0ms dart/exe 2.19.0
java 2-m.java 1621ms 30ms 44.3MB 3063ms 17ms openjdk 19
java 2-m.java 1721ms 70ms 40.9MB 3273ms 10ms openjdk 20
java 2-m.java 1769ms 188ms 42.1MB 3277ms 53ms openjdk/zgc 19

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 331ms 2.5ms 14.0MB 317ms 0ms dart/exe 2.19.0
java 2-m.java 435ms 21ms 89.1MB 727ms 33ms graal/jvm 17.0.6
java 2-m.java 552ms 40ms 41.0MB 977ms 13ms openjdk 20
java 2-m.java 589ms 38ms 44.3MB 1043ms 10ms openjdk 19
java 2-m.java 636ms 31ms 43.9MB 1040ms 57ms openjdk/zgc 19