![]() Given the decades of honing I highly doubt that's possible.īut see, the thing is, much (I hesitate to say "all," but that's kind of what I'm thinking) software stagnates as new opportunities around it rise up. ![]() ![]() See, people get caught up in bullshit attitudes like this: $ time rg '\w' subtitles-en-2016_5000000.txt -cĭoes this mean that the person you responded to was using a full regex query, with Unicode enabled and no opportunity for literal optimizations? I have no clue, but this example proves your priors are just plain wrong. Is ripgrep usually a full order of magnitude faster, straight up, in comparison to GNU grep? Nope. And my blog post (the OP) covers that in detail. The interesting comparison between GNU grep and ripgrep is on a single file. The apples-to-apples comparison there is not usually interesting because ripgrep is parallelized by default, so that's just going to make it a lot faster on that basis alone. gitignore logic with grep.ĮDIT: There are also benchmarks in ripgrep's README that do an apples-to-apples comparison of recursive directory search between GNU grep and ripgrep. It (along with git grep) will just ignore all that stuff automatically because it's already in your. That's one of the big value propositions of ripgrep. And if you're in a Rust project, you probably want -exclude-dir=target. And if you're in a Node project, you probably also want -exclude-dir=node_modules. git folder, among other things.Īnd yes, if you're using grep, then you can add -exclude-dir=.git to ignore it. My comment was comparing git grep and rg. Ripgrep has cliffs too, but far fewer of them and they are generally harder to hit in common usage. OK, so at least I was able to wait for it to finish, but perf just falls off a cliff as soon as you use an actual regex. $ time git grep -E '\w+ PM_RESUME' | wc -l Okay, let's try a smaller repo, like the Linux kernel: $ git remote -v $ time LC_ALL=C git grep -E '\w+ Openbox' | wc -l Make it a little more complicated than a simple literal and. ![]() So maybe you're like, "meh okay ripgrep is a little faster, but if I can wait 350ms, then I can wait 1s." Fair. Here are some examples on my checkout of the chromium repo, which is quite big: $ git remote -v The usual issue with git grep is that it can be slow in bigger repositories (perhaps more like tens of thousands of files), and it tends to only work well in the context of git repos. The latter is similarish to rg where as the former is like rg -uuu. Note that grep and git grep are two different programs. Are you interested in promoting your own content? STOP! Read this first.For posting job listings, please visit /r/forhire or /r/jobbit.Do you have something funny to share with fellow programmers? Please take it to /r/ProgrammerHumor/.Do you have a question? Check out /r/learnprogramming, /r/cscareerquestions, or Stack Overflow.Direct links to app demos (unrelated to programming) will be removed.If there is no code in your link, it probably doesn't belong here. Just because it has a computer in it doesn't make it programming.That means no image posts, no memes, no politics.Please keep submissions on topic and of high quality.r/programming is a reddit for discussion and news about computer programming
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |