From patchwork Fri Nov 22 15:24:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36111 Received: (qmail 127441 invoked by alias); 22 Nov 2019 15:24:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 127368 invoked by uid 89); 22 Nov 2019 15:24:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Nov 2019 15:24:15 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 5EC972046F; Fri, 22 Nov 2019 10:24:09 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id D28D1203C1; Fri, 22 Nov 2019 10:24:06 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id A46792816F; Fri, 22 Nov 2019 10:24:06 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Fri, 22 Nov 2019 10:24:06 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom de Vries , gdb-patches@sourceware.org Cc: Kevin Buettner Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] [gdb/contrib] Combine sed invocations in words.sh script X-Gerrit-Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b X-Gerrit-Change-Number: 653 X-Gerrit-ChangeURL: X-Gerrit-Commit: f618007364b84739f6f8663c1c634fb47bbc6732 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tdevries@suse.de, kevinb@redhat.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191122152406.A46792816F@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/653 ...................................................................... [gdb/contrib] Combine sed invocations in words.sh script Currently running words.sh on all the c source and header files in the repo takes ~16s in user time: ... $ time ./gdb/contrib/words.sh \ $(find -type f -name "*.c" -o -name "*.h") \ >/dev/null real 0m7,787s user 0m16,349s sys 0m0,367s ... Rewrite the sed invocations using the -e option from this: ... | sed | sed ... into this: ... | sed \ -e -e ... and reduce user time to ~11s: ... $ time ./gdb/contrib/words.sh \ $(find -type f -name "*.c" -o -name "*.h") \ >/dev/null real 0m7,243s user 0m11,220s sys 0m0,205s ... gdb/ChangeLog: 2019-11-22 Tom de Vries * contrib/words.sh: Combine sed invocations. Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b --- M gdb/ChangeLog M gdb/contrib/words.sh 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 81c6690..25c63c7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2019-11-22 Tom de Vries + + * contrib/words.sh: Combine sed invocations. + 2019-11-21 Christian Biesinger * Makefile.in: Update. diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh index ae38539..8c4fdd0 100755 --- a/gdb/contrib/words.sh +++ b/gdb/contrib/words.sh @@ -114,12 +114,13 @@ awk \ -f "$awkfile" \ -- "$@" \ - | sed 's/[%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \ - | sed 's/\[/\n/g' \ - | sed 's/\]/\n/g' \ - | sed 's/[0-9][0-9]*/\n/g' \ + | sed \ + -e 's/[%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \ + -e 's/\[/\n/g' \ + -e 's/\]/\n/g' \ + -e 's/[0-9][0-9]*/\n/g' \ + -e 's/[ \t]*//g' \ | tr '[:upper:]' '[:lower:]' \ - | sed 's/[ \t]*//g' \ | sort \ | uniq -c \ | awk "{ if (($minfreq == 0 || $minfreq <= \$1) \