Kotlin VS Php benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M 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
kotlin 1.kt 793ms 13ms 413.5MB 770ms 157ms kotlin/jvm 17.0.2
kotlin 1.kt timeout 0.0ms 194.4MB 8290ms 1107ms kotlin/native 1.8.10
php 1.php timeout 0.0ms 141.3MB 4927ms 50ms php 8.2.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 155ms 4.2ms 109.3MB 123ms 43ms kotlin/jvm 17.0.2
kotlin 1-m.kt 657ms 26ms 34.4MB 1093ms 130ms kotlin/native 1.8.10
php 1.php 983ms 7.1ms 62.4MB 943ms 20ms php 8.2.2

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 3597ms 413ms 161.1MB 6813ms 113ms kotlin/jvm 17.0.2
kotlin 1.kt 3783ms 53ms 155.5MB 4727ms 100ms kotlin/jvm 17.0.2
kotlin 1.kt timeout 0.0ms 10.8MB 6150ms 310ms kotlin/native 1.8.10
kotlin 2-m.kt timeout 0.0ms 35.5MB 9297ms 157ms kotlin/native 1.8.10

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 826ms 21ms 94.0MB 1427ms 67ms kotlin/jvm 17.0.2
kotlin 2-m.kt 1125ms 20ms 19.5MB 2007ms 60ms kotlin/native 1.8.10
kotlin 2-m.kt 1200ms 149ms 106.7MB 2163ms 60ms kotlin/jvm 17.0.2
kotlin 1.kt 1335ms 37ms 8.9MB 1620ms 73ms kotlin/native 1.8.10

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 2.6ms 0.4ms 1.5MB 0ms 0ms kotlin/native 1.8.10
php 1.php 58ms 2.1ms 51.3MB 28ms 16ms php 8.2.2
kotlin 1.kt 78ms 1.3ms 40.7MB 62ms 10ms kotlin/jvm 17.0.2

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 239.0MB 8937ms 550ms kotlin/jvm 17.0.2
kotlin 2.kt timeout 0.0ms 290.5MB 8860ms 547ms kotlin/jvm 17.0.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 2885ms 302ms 195.7MB 3507ms 273ms kotlin/jvm 17.0.2
kotlin 1-m.kt 3422ms 196ms 183.7MB 5610ms 430ms kotlin/jvm 17.0.2

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1346ms 36ms 211.9MB 2263ms 103ms kotlin/jvm 17.0.2

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 890.0MB 7643ms 330ms kotlin/jvm 17.0.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2-m.kt 300ms 6.2ms 113.5MB 417ms 47ms kotlin/jvm 17.0.2
kotlin 1.kt 303ms 5.8ms 109.7MB 373ms 30ms kotlin/jvm 17.0.2
kotlin 2-m.kt 531ms 3.3ms 42.3MB 777ms 33ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 15.0MB 5003ms 7ms kotlin/native 1.8.10

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 2.kt 497ms 17ms 130.5MB 600ms 57ms kotlin/jvm 17.0.2
kotlin 1.kt 592ms 9.7ms 132.2MB 643ms 43ms kotlin/jvm 17.0.2
kotlin 2-m.kt 1648ms 11ms 114.0MB 2420ms 93ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 15.0MB 4997ms 10ms kotlin/native 1.8.10

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 220ms 4.7ms 77.2MB 297ms 30ms kotlin/jvm 17.0.2
kotlin 2-m.kt 221ms 14ms 78.5MB 307ms 40ms kotlin/jvm 17.0.2
kotlin 2-m.kt 264ms 5.1ms 32.3MB 410ms 20ms kotlin/native 1.8.10
kotlin 1.kt timeout 0.0ms 17.1MB 4997ms 13ms kotlin/native 1.8.10

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 580ms 1.6ms 363.2MB 553ms 110ms kotlin/jvm 17.0.2
kotlin 1-m.kt 3664ms 86ms 138.6MB 5797ms 787ms kotlin/native 1.8.10
php 1.php timeout 0.0ms 113.2MB 4943ms 37ms php 8.2.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 234ms 5.3ms 221.4MB 200ms 63ms kotlin/jvm 17.0.2
kotlin 1-m.kt 732ms 13ms 38.4MB 1173ms 133ms kotlin/native 1.8.10
php 1.php 1378ms 5.3ms 66.4MB 1340ms 20ms php 8.2.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 768ms 9.5ms 42.9MB 757ms 27ms kotlin/jvm 17.0.2
kotlin 1n.kt 837ms 45ms 1.5MB 827ms 0ms kotlin/native 1.8.10

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1n.kt 88ms 3.6ms 1.5MB 80ms 0ms kotlin/native 1.8.10
kotlin 1.kt 185ms 11ms 43.0MB 183ms 20ms kotlin/jvm 17.0.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 204.7MB 5390ms 100ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 14.9MB 6577ms 220ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 8.4MB 5067ms 107ms kotlin/native 1.8.10

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1691ms 16ms 244.6MB 2053ms 87ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 22.9MB 6607ms 190ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 10.4MB 5077ms 100ms kotlin/native 1.8.10

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 161.4MB 5357ms 67ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 277.3MB 5270ms 943ms kotlin/native 1.8.10

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1213ms 13ms 96.9MB 1667ms 37ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 65.1MB 6333ms 47ms kotlin/native 1.8.10

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 182.5MB 5997ms 97ms kotlin/jvm 17.0.2

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1-m.kt 1604ms 20ms 182.9MB 2433ms 83ms kotlin/jvm 17.0.2