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 <[email protected]>: > > 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 > patches[${#patches[@]}]="$*" > [...] > done < $tmpfile > > if [ ${#patches[@]} -gt 0 ] > then > [...] > ( echo ... > printf "%s\n" "${patches[@]}" > ) > "$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 _______________________________________________ Quilt-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/quilt-dev
