Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
quilt
quilt-boost-the-speed-of-series-applied-and-una...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File quilt-boost-the-speed-of-series-applied-and-unapplied.patch of Package quilt
From: Jean Delvare <jdelvare@suse.de> Date: Sun, 2 Mar 2014 16:29:24 +0100 Subject: Boost the speed of the series, applied and unapplied commands Patch-mainline: yes Git-commit: e052a2d22569f56a30285716da11b4e0a1eed052 References: bnc#872719 The current implementation of the series, applied and unapplied commands performs rather poorly, especially on large patch sets. To make things worse, bash completion makes use of these commands, so it becomes next to unusable on large patch sets. Instead of looping over each patch, use the power of printf to print everything in one go. Performance gains on a 15k patch series are breathtaking: series: 189.4 s -> 0.6 s series -v: 92.9 s -> 0.6 s applied: 3.5 s -> 0.1 s unapplied: 3.9 s -> 0.1 s --- quilt/applied.in | 5 +---- quilt/scripts/patchfns.in | 8 ++++++++ quilt/series.in | 9 ++++----- quilt/unapplied.in | 10 ++-------- 4 files changed, 15 insertions(+), 17 deletions(-) --- a/quilt/applied.in +++ b/quilt/applied.in @@ -61,10 +61,7 @@ patch=$(find_applied_patch "$1") || exit setup_pager -for patch in $(applied_before "$patch") $patch -do - echo "$(print_patch $patch)" -done +printf "$(patch_format)\n" $(applied_before "$patch") "$patch" ### Local Variables: ### mode: shell-script --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -976,6 +976,14 @@ print_patch() { echo -n "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1" } +# Generate a format suitable to print patch names with printf +patch_format() +{ + local prefix=${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/} + + echo -n "${prefix/\%/%%}%s" +} + setup_colors() { local C=diff_hdr=32:diff_add=36:diff_mod=35:diff_rem=35:diff_hunk=33:diff_ctx=35:diff_cctx=33:patch_offs=33:patch_fuzz=35:patch_fail=31:series_app=32:series_top=33:series_una=00:clear=00 --- a/quilt/series.in +++ b/quilt/series.in @@ -40,12 +40,11 @@ cat_patches() { local color=$1 prefix=$2 shift 2 - local patch - for patch in "$@" - do - echo "$color$prefix$(print_patch "$patch")$color_clear" - done + if [ $# -ge 1 ] + then + printf "$color$prefix$(patch_format)$color_clear\n" "$@" + fi } options=`getopt -o vh --long color:: -- "$@"` --- a/quilt/unapplied.in +++ b/quilt/unapplied.in @@ -67,14 +67,8 @@ fi setup_pager -( - echo "$patch" - patches_after "$patch" -) \ -| while read patch -do - echo "$(print_patch $patch)" -done +printf "$(patch_format)\n" "$patch" $(patches_after "$patch") + ### Local Variables: ### mode: shell-script ### End:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor