3 ms·
Obviously, because the PHP regex engine is written in C, not in PHP. It's more like Rust's regex crate vs C PCRE rather than PHP, or who calls system call faste
by nicklauri 7y ago
Obviously, because the PHP regex engine is written in C, not in PHP. It's more like Rust's regex crate vs C PCRE rather than PHP, or who calls system call faster. While Rust's IO is locked[1] and doesn't buffer (which is slower than buffered, unsynchronized IO like other languages). And regex crate is slow when capturing, which is used on the "benchmark".
Reference: https://www.reddit.com/r/rust/comments/5zit0e/regex_captures_slow_compared_to_python/ https://www.reddit.com/r/rust/comments/5zit0e/regex_captures...
2 years ago, but it's still valid to me, I've just tested it and it's much slower as I expected.
Feel free to correct me if I'm wrong :)
[1]: https://doc.rust-lang.org/std/io/fn.stdout.html https://doc.rust-lang.org/std/io/fn.stdout.html