bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About speed evaluation


From: L A Walsh
Subject: Re: About speed evaluation
Date: Sun, 06 Sep 2020 12:06:26 -0700
User-agent: Thunderbird

On 2020/09/06 05:52, Oğuz wrote:
6 Eylül 2020 Pazar tarihinde almahdi <budikusasi@gmail.com> yazdı:

How slower find -exec repetitively calling bash -c'' for invoking a
function
inside, compare to pipe repeated
----

   How I read that (dunno if it is right) was:
"How much slower is 'find -exec' than repetitively calling 'bash -c' for
the purpose of invoke a function inside (the script or target of what
'exec' or '-c' executes) compared to piping all the answers to something
like 'xargs' receiving all of the args and either:
1) executing as many as possible/invocation, or
2) executing 1 script for each 'item' that is listed by find?

   i.e. seems to be wanting to know tradeoffs between

   find <dir> <findstuff> -exec func_in_script "{} ;"       AND
   find <dir> <findstuff> -exec "bash -c func_in_script \"{}\" ;"
 AND
   find <dir> <findstuff> printf0 | xargs -0 func_in_script where
              func is called in a loop for each arg passed to it

   That was my interpretation.  One note...in most cases, you aren't
calling 'pipe repeated'.  The pipe is at the end of the find, and is
created *once* between the output of find and the input of the next
program (ex. xargs)
   Given my interpretation (which may be incorrect), note that
the first 2, above, both require starting a new copy of bash
for each object found.  That load+start time will vary depending
on what OS you are using and what version of each OS.  You can't
really answer "how much" as there isn't a general answer, but
in almost all cases (likely all), the answer that only invokes
one post-processor on all the args (the one where all answers
are piped into xargs) will be ***significantly*** faster than any
implementation that calls the processing function repeatedly (as in
the first two examples, above).

   So the cryptic, one-word answer would be "***significantly***".


   This is my interpretation and answer to what appears to be
the question.

all work correctly, so this ask all just on speed evaluation or comparison
----
   Using relative speed, invoking the post-processor only once
would normally be the fastest answer, by far, "comparatively" speaking.

(1st answer suggest function inside script to be invoked by -exec
2nd answer suggest solution by some core utils pipings ).
--
This needs some grammar, I didn't understand it all.

- Linda





reply via email to

[Prev in Thread] Current Thread [Next in Thread]