How come PHP seems so much faster than Rust?
1–10 of 116 posts
Re: How come PHP seems so much faster than Rust?
#2Re: How come PHP seems so much faster than Rust?
#3Re: How come PHP seems so much faster than Rust?
#4But in that benchmark apparently Rust is faster than PHP (The slowest "Rust #2" is 2.45 sec. while PHP is 2.80 sec. He also mentioned "PCRE", but the ones with Perl in name are even much more slower [the fastest being 14.95 sec.]).
Did I miss his point by linking that benchmark, or did I interpret the benchmark wrong?
[1]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Re: How come PHP seems so much faster than Rust?
#5The only way to know for sure would be to profile each bit to see what dominates: the file I/O? The regex matching? The FFI? The printing to stdout?
Also, looks like there is a rust wrapper for PCRE[0]; might be interesting to try it to get a more apples-to-apples comparison.
Re: How come PHP seems so much faster than Rust?
#6The top reply says "Don't underestimate PHP when regexes are involved." and linked a benchmark [1]. But in that benchmark apparently Rust is faster than PHP (The slowest "Rust #2" is 2.45 sec. while PHP is 2.80 sec. He also mentioned "PCRE", but the ones with Perl in name are even much more slower [the fastest being 14.95 sec.]). Did I miss his point by linking that benchmark, or did I interpret the benchmark wrong?…
Other comments address why the Rust program is not optimal.
Re: How come PHP seems so much faster than Rust?
#7This code is mostly just testing the regex engine?
Re: How come PHP seems so much faster than Rust?
#8The top reply says "Don't underestimate PHP when regexes are involved." and linked a benchmark [1]. But in that benchmark apparently Rust is faster than PHP (The slowest "Rust #2" is 2.45 sec. while PHP is 2.80 sec. He also mentioned "PCRE", but the ones with Perl in name are even much more slower [the fastest being 14.95 sec.]). Did I miss his point by linking that benchmark, or did I interpret the benchmark wrong?…
Id take that slowdown any day just not having to touch Rust though :^)
Re: How come PHP seems so much faster than Rust?
#9There will be some difference in the regex engine speed, because PCRE is very fast in common cases.
But doing a single regex match is not that much work, so it probably boils down to I/O.
And PHP might use extra buffering to get better throughput for the common "stream a file" scenario.
Similar question with Python being faster than C++:
https://stackoverflow.com/questions/9371238/why-is-reading-l...