Perl VS Rust benchmarks

Current benchmark data was generated on Mon Feb 06 2023, 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
rust 4.rs 1746ms 19ms 33.8MB 1717ms 13ms rustc 1.67.0
rust 5.rs 1946ms 27ms 33.7MB 1917ms 13ms rustc 1.67.0
rust 3.rs 2082ms 16ms 49.9MB 2047ms 20ms rustc 1.67.0
perl 1.pl timeout 0.0ms 77.5MB 4947ms 37ms perl 5.36.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4.rs 153ms 0.2ms 5.7MB 140ms 0ms rustc 1.67.0
rust 5.rs 168ms 0.6ms 5.8MB 160ms 0ms rustc 1.67.0
rust 3.rs 177ms 2.0ms 7.8MB 167ms 0ms rustc 1.67.0
perl 1.pl 2201ms 12ms 14.1MB 2187ms 0ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5c-m.rs 177ms 2.2ms 1.7MB 310ms 0ms rustc 1.69.0-nightly
rust 5-m.rs 196ms 3.3ms 1.7MB 347ms 0ms rustc 1.67.0
rust 1c.rs 213ms 0.5ms 1.1MB 200ms 0ms rustc 1.69.0-nightly
rust 1.rs 272ms 8.0ms 1.0MB 260ms 0ms rustc 1.67.0
perl 1.pl 4364ms 36ms 11.0MB 4347ms 3ms perl 5.36.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1c.rs 25ms 0.5ms 1.0MB 17ms 0ms rustc 1.69.0-nightly
rust 5c-m.rs 29ms 1.4ms 1.7MB 27ms 0ms rustc 1.69.0-nightly
rust 1.rs 30ms 0.5ms 1.1MB 20ms 0ms rustc 1.67.0
rust 5-m.rs 31ms 0.8ms 1.8MB 40ms 0ms rustc 1.67.0
perl 1.pl 446ms 3.6ms 6.5MB 430ms 0ms perl 5.36.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 1.8ms 0.6ms 1.7MB 0ms 0ms rustc 1.69.0-nightly
rust 1.rs 2.4ms 0.7ms 1.0MB 0ms 0ms rustc 1.67.0
perl 1.pl 3.3ms 0.7ms 3.8MB 0ms 0ms perl 5.36.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4-i.rs 213ms 0.6ms 1.0MB 200ms 0ms rustc 1.67.0
rust 7-i.rs 310ms 0.5ms 1.1MB 300ms 0ms rustc 1.67.0
rust 2.rs 344ms 0.2ms 1.1MB 333ms 0ms rustc 1.67.0
rust 3.rs 347ms 1.3ms 1.1MB 330ms 0ms rustc 1.69.0-nightly
rust 1.rs 421ms 4.5ms 1.0MB 407ms 0ms rustc 1.67.0
perl 2.pl timeout 0.0ms 6.3MB 4987ms 0ms perl 5.36.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4-i.rs 24ms 0.3ms 1.0MB 10ms 0ms rustc 1.67.0
rust 7-i.rs 34ms 0.3ms 1.1MB 23ms 0ms rustc 1.67.0
rust 2.rs 37ms 0.1ms 1.0MB 27ms 0ms rustc 1.67.0
rust 3.rs 37ms 0.2ms 1.1MB 30ms 0ms rustc 1.69.0-nightly
rust 1.rs 45ms 0.6ms 1.0MB 33ms 0ms rustc 1.67.0
perl 2.pl 3096ms 23ms 6.1MB 3080ms 0ms perl 5.36.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 897ms 2.7ms 2.5MB 1733ms 0ms rustc 1.69.0-nightly
rust 7-m.rs 900ms 3.1ms 2.3MB 1733ms 3ms rustc 1.67.0
rust 8.rs 1724ms 0.3ms 2.4MB 1710ms 0ms rustc 1.69.0-nightly
rust 7.rs 1731ms 0.8ms 1.1MB 1717ms 0ms rustc 1.67.0
rust 2-m.rs 1827ms 1.5ms 2.3MB 3553ms 0ms rustc 1.67.0
perl 4.pl timeout 0.0ms 10.3MB 9857ms 3ms perl 5.36.0
rust 2.rs timeout 0.0ms 2.2MB 4987ms 0ms rustc 1.67.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 236ms 3.3ms 2.3MB 427ms 0ms rustc 1.69.0-nightly
rust 7-m.rs 238ms 2.4ms 1.0MB 430ms 0ms rustc 1.67.0
rust 8.rs 434ms 0.3ms 2.2MB 423ms 0ms rustc 1.69.0-nightly
rust 7.rs 436ms 0.4ms 1.1MB 427ms 0ms rustc 1.67.0
rust 2-m.rs 481ms 9.7ms 2.1MB 897ms 0ms rustc 1.67.0
rust 2.rs 1631ms 3.2ms 1.1MB 1620ms 0ms rustc 1.67.0
perl 4.pl timeout 0.0ms 9.5MB 9723ms 7ms perl 5.36.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 65ms 1.0ms 1.0MB 107ms 0ms rustc 1.69.0-nightly
rust 7-m.rs 66ms 2.1ms 1.1MB 103ms 0ms rustc 1.67.0
rust 8.rs 111ms 0.3ms 1.0MB 100ms 0ms rustc 1.69.0-nightly
rust 7.rs 111ms 0.4ms 1.8MB 100ms 0ms rustc 1.67.0
rust 2-m.rs 125ms 0.4ms 1.0MB 220ms 0ms rustc 1.67.0
rust 2.rs 410ms 0.4ms 1.0MB 400ms 0ms rustc 1.67.0
perl 4-m.pl 4838ms 34ms 9.4MB 9407ms 3ms perl 5.36.0