4 ms·
Yes, yes and yes. :-) https://github.com/rust-lang/regex/blob/3db8722d0b204a85380fe2a65e13d7065d7dd968/scripts/frequencies.py#L3-L11 https://github.com/rust-la
by burntsushi 6y ago
Yes, yes and yes. :-)
https://github.com/rust-lang/regex/blob/3db8722d0b204a85380fe2a65e13d7065d7dd968/scripts/frequencies.py#L3-L11 https://github.com/rust-lang/regex/blob/3db8722d0b204a85380f...
- pletnes 6y agoWow, cool! Since rg (which is awesome) understands which programming languages map to which file suffixes, could it make sense to do per-language frequency analysis? {}[] are common in C-style languages, but much less so in lisp, python, etc.
- burntsushi 6y agoIt could. But there's a lot of code complexity there because ripgrep is made from de-coupled components. Implementing your idea would require making that frequency distribution available as an overridable element all the way down into where substring search is actually implemented (a transitive dependency of ripgrep). On top of that, it's unlikely to make much of a difference. Not only would the frequency distributions between languages look pretty similar, but it's still just a guess at the end of the day. There is such a thing as overfitting too. :-)