3 ms·
Things like search time are *not* a productivity bottleneck. I would recommend, as a general rule, not generalizing from your development experience to everyon
by jlebar 10y ago
Things like search time are *not* a productivity bottleneck.
I would recommend, as a general rule, not generalizing from your development experience to everyone's development experiences.
I happen to know that git grep is very carefully optimized. Someone cared a lot about making it run fast. Seems like a good guess that they did so because it was important to them or someone else, not just for funzies.
$ grep '^git grep' ~/.bash_history | wc -l
407
$ grep -w '^ls' ~/.bash_history | wc -l
37
$ wc -l ~/.bash_history
19421
"git grep" is 2% of all the commands I type. I type it 10x as often as "ls". So, yeah, its speed matters to me. :)
- ubernostrum 10y agoI would recommend, as a general rule, not generalizing from your development experience to everyone's development experiences. What's interesting here is that it's the exact thing happening. Someone asked about how much hidden cost there is from the time people waste fighting to make git do what they need it to do, and it got derailed with a discussion of how `git grep` is faster than `hg` grep`. I'm sure it's great for you that git's grep is fast. But the time you gain from how much faster it is than hg probably is strongly outweighed by the time other people lose to struggling with git's interface. Unfortunately there's no easy way to benchmark that.
- BeetleB 10y ago>"git grep" is 2% of all the commands I type. I type it 10x as often as "ls". So, yeah, its speed matters to me. :) I appreciate that - I know the frustration of tools being a bit laggy. However, I think you are falling for the [Endowment Effect](https://en.wikipedia.org/wiki/Endowment_effect https://en.wikipedia.org/wiki/Endowment_effect). You are accustomed to it, so the alternative seems horrible without you really thinking it through. If you were not already using grep, the search issue would not be a big deal. I already pointed out how merely excluding ".hg" from your search will save all the time, and this benefit you speak of disappears (please correct me if I'm wrong). On my shell, that's as simple as creating an alias for grep to always exclude ".hg". Yes, I'll grant that searching Mercurial repositories is a lot slower. But you need to understand that the obvious solution is not "Switch to git". There are simpler solutions. In that sense, this seems to be a very insignificant benefit of git, even for people like you who need to search often. To beat a dead horse, if you had two developers: One using git and the other using mercurial, and both need to search heavily, the mercurial person will likely have already solved the problem in one way or another. It'd be a bit silly for an observer to look at them and say "Ah, Git is so much better because it did not require a shell alias for faster searches!"