Talk:Portupgrade
Line 19: | Line 19: | ||
But I agree with your point of view... grep has to be known by the users ! | But I agree with your point of view... grep has to be known by the users ! | ||
The "-l" flag may sometimes be preferable, for a low system for example... | The "-l" flag may sometimes be preferable, for a low system for example... | ||
+ | |||
+ | Yah, if I was scripting repeated operations, by all means I'd use the more efficient way. But in general I think the modularity of *nix is actually by far the best thing about it, and I try to do things as modular as possible if there isn't a compelling reason to do otherwise. Even in my own just day-to-day stuff; sure I already know about grep, but still actually using it for everything keeps me in the habit of using it and that's more useful to me than being in the habit of using something that only applies to portversion, y'know? =) | ||
+ | |||
+ | Btw, the difference in efficiency isn't anywhere near as compelling on my systems: | ||
+ | |||
+ | ph34r# /usr/bin/time -h portversion -l '<' > /dev/null | ||
+ | 0.88s real 0.70s user 0.18s sys | ||
+ | ph34r# /usr/bin/time -h portversion | grep '<' > /dev/null | ||
+ | 0.89s real 0.68s user 0.21s sys | ||
+ | |||
+ | or | ||
+ | |||
+ | blackbox# /usr/bin/time -h portversion -l '<' > /dev/null | ||
+ | 1.03s real 0.83s user 0.18s sys | ||
+ | blackbox# /usr/bin/time -h portversion | grep '<' > /dev/null | ||
+ | 1.04s real 0.83s user 0.19s sys | ||
+ | |||
+ | --[[User:Jimbo|Jimbo]] 11:52, 10 Jul 2005 (EDT) | ||
+ | |||
+ | ---- | ||
+ | ---- |
Revision as of 10:52, 10 July 2005
note on the rollback: I strongly prefer showing a pipe to grep rather than the -l argument because they both accomplish the same thing, but piping to grep is a universal tool than can be used with any command or process. It's a good habit to learn using tools and skills that are universally applicable as opposed to stuff that's only applicable to one particular task, unless there is some marked advantage to using the more proprietary method of doing things.
If you know of some particularly good reason to use the -l argument instead of piping to grep, by all means let me know here. --Jimbo 19:23, 9 Jul 2005 (EDT)
The goal is just avoiding to use two processes when only one is needed... More, I tried this :
Script started on Sun Jul 10 11:35:19 2005 # time portversion -l '<' > /dev/null portversion 1.90s user 0.68s system 86% cpu 3.001 total # time portversion | grep '<' > /dev/null portversion 2.68s user 0.88s system 69% cpu 5.102 total grep '<' > /dev/null 0.00s user 0.00s system 0% cpu 5.100 total Script done on Sun Jul 10 11:36:23 2005
I do not know how it work internaly, but I gess that the "-l" argument changes the search algorithme.
But I agree with your point of view... grep has to be known by the users ! The "-l" flag may sometimes be preferable, for a low system for example...
Yah, if I was scripting repeated operations, by all means I'd use the more efficient way. But in general I think the modularity of *nix is actually by far the best thing about it, and I try to do things as modular as possible if there isn't a compelling reason to do otherwise. Even in my own just day-to-day stuff; sure I already know about grep, but still actually using it for everything keeps me in the habit of using it and that's more useful to me than being in the habit of using something that only applies to portversion, y'know? =)
Btw, the difference in efficiency isn't anywhere near as compelling on my systems:
ph34r# /usr/bin/time -h portversion -l '<' > /dev/null 0.88s real 0.70s user 0.18s sys ph34r# /usr/bin/time -h portversion | grep '<' > /dev/null 0.89s real 0.68s user 0.21s sys
or
blackbox# /usr/bin/time -h portversion -l '<' > /dev/null 1.03s real 0.83s user 0.18s sys blackbox# /usr/bin/time -h portversion | grep '<' > /dev/null 1.04s real 0.83s user 0.19s sys
--Jimbo 11:52, 10 Jul 2005 (EDT)