[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] [PATCH] setup: Optimize the generation of the series fil
From: |
Jean Delvare |
Subject: |
Re: [Quilt-dev] [PATCH] setup: Optimize the generation of the series file |
Date: |
Thu, 06 Mar 2014 14:40:36 +0100 |
Hi Andreas,
Le Thursday 06 March 2014 à 14:25 +0100, Andreas Grünbacher a écrit :
> 2014-03-06 13:41 GMT+01:00 Jean Delvare <address@hidden>:
> > When quilt setup generates a series file, keep it open while we write
> > to it, and close it only when we're done. For large patch series, it's
> > much more efficient than individual redirections which open and close
> > the file again and again.
> >
> > This change makes the generation of the series file about 10% faster
> > in my tests, although it's hardly noticeable in practice because most
> > of the time is spent elsewhere.
>
> if you're *really* worried about the speed of this loop, a cleaner
> approach would
> be to remember all the patches in an array, e.g.,
>
> declare -a patches
> while read tag dir arg1 arg2
> do
> [...]
> set -- "$arg1" $arg2
> address@hidden"$*"
> [...]
> done < $tmpfile
>
> if [ address@hidden -gt 0 ]
> then
> [...]
> ( echo ...
> printf "%s\n" "address@hidden"
> ) > "$prefix$dir/$QUILT_SERIES"
> fi
This is a great idea. I suppose I had the nose too close to the code so
I didn't see the whole picture. I'll try to implement what you
suggested, I agree it is cleaner and might be even faster.
Thanks,
--
Jean Delvare
SUSE L3 Support