4 ms·
Does anyone know how ripgrep's pcre support compares to python/Perl/awk/sed for speed? I noticed it can do substitutions, so I'm curious.
by shaklee3 8y ago
Does anyone know how ripgrep's pcre support compares to python/Perl/awk/sed for speed? I noticed it can do substitutions, so I'm curious.
- asicsp 8y agoI haven't tried it yet, but it would depend on what sort of features you need Python wouldn't be a good choice for cli usage Perl is awesome to use from cli, and it is not just simple search and replace, see my tutorial[1] if you want to see examples sed and awk are awesome on their own for cli usage, sed is meant for line oriented tasks and awk for field oriented ones (there is overlap too) - one main difference compared to perl is that their regex is BRE/ERE which is generally faster but lacks in many features like lookarounds, non-greedy, named capture groups, etc you could check out sd[2] for a Rust implementation of sed like search and replacement (small subset of sed features) [1] https://github.com/learnbyexample/Command-line-text-processing/blob/master/perl_the_swiss_knife.md https://github.com/learnbyexample/Command-line-text-processi... [2] https://github.com/chmln/sd https://github.com/chmln/sd
- shaklee3 8y agoThanks! I was mostly asking because I've found Python's regular expressions to be extremely slow compared to egrep, and Perl is in the middle. It's annoying to have to call subprocess functions in python just too launch egrep on large files.
- burntsushi 8y agoripgrep enables PCRE2's JIT, so it should be very fast.