9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] [PATCH] g: use xargs instead of finding complete file list before greping
Date: Wed, 05 Jan 2022 20:35:59 -0500	[thread overview]
Message-ID: <DD6AA4FA3D15EA2A6F014E7F6BEF8C2E@eigenstate.org> (raw)
In-Reply-To: <CAGw6cBs-+HCC5GxB=wpEKKqWki51G_CosZeWdLf6BNo_CVm7Kg@mail.gmail.com>

Quoth Michael Forney <mforney@mforney.org>:
> On 2022-01-04, igor@9lab.org <igor@9lab.org> wrote:
> > xargs also has a parallel mode that comes in handy to speed up search
> > in this case.
> 
> Is there a possibility that this might result in intermixed grep
> results (i.e. one process printing a line in the middle of a another
> line)? That'd be my main concern with adding parallelism to xargs.
> 
> >  case *
> > -	pattern=$1
> > -	shift
> >  	for(f in $*){
> >  		if(test -d $f)
> > -			files=($files `$nl{walk -f $recurse -- $* \
> > -				| grep -e $fullnames -e $suffixes >[2]/dev/null})
> > +			walk -f $recurse -- $f \
> > +				| grep -e $fullnames -e $suffixes >[2]/dev/null
> >  		if not
> > -			files=($files $f)
> > +			echo -n $f$nl
> 
> If we don't care about ordering of results, we could also skip the
> for-loop completely and replace this entire case with
> 
> 	walk -f -n0 -- $*
> 	walk -f $recurse -- $* | grep -e $fullnames -e $suffixes >[2]/dev/null
> 
> and change the default to recurse='-n1,'. This would walk all named
> file arguments first, followed by the files in the directories.
> 

And if we do, we can |sort at the end, which means the results won't
trickle in, but it will be sorted. I'd prefer that.



  reply	other threads:[~2022-01-06 10:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-01 10:26 Michael Forney
2022-01-02  1:13 ` 有澤 健治
2022-01-02  1:20   ` ori
2022-01-02  4:56     ` 有澤 健治
2022-01-02  2:34   ` Michael Forney
2022-01-02  1:28 ` 有澤 健治
2022-01-05  0:05 ` igor
2022-01-05  3:05   ` Michael Forney
2022-01-06  1:35     ` ori [this message]
2022-01-06 10:47       ` igor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DD6AA4FA3D15EA2A6F014E7F6BEF8C2E@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).