On Sun, 2011-06-19 at 19:44 +0200, Harald Becker wrote:
> Hi!
>
> >>> find / -xdev -type f -print0 | xargs -0 readelf -d
> >> FYI: This is more efficient than using a pipe:
> >>
> >> find / -xdev -type f -exec readelf -d '{}' 2>/dev/null \;
> > In which way should this be more efficient?
>
> Your question is the reason I kept the pipe version in my suggestion. As
> far as I know does xarg execute the command only once with many
> arguments on a single command line. This can be much faster than
> invoking the same program many times with only one argument. So why
> shall "-exec" be much more efficient (except removing the pipe)?
>
> --
> Harald
Yes, I see that now. I was simply thinking about creating the subshells
and joining them with the pipe. Running a test myself, the pipe version
for readelf (which can take all of the elf files on the same cmdline) is
a bit faster. Thanks for pointing that out Harald. I've mostly used
-exec because I just thought it was better in all cases - clearly it's
not.
-C
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox