public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] [gdb/contrib] Combine sed invocations in words.sh script
@ 2019-11-15  9:53 Tom de Vries (Code Review)
  2019-11-22  3:27 ` Kevin Buettner (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries (Code Review) @ 2019-11-15  9:53 UTC (permalink / raw)
  To: gdb-patches

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 <sedprog1>
   | sed <sedprog2>
...
into this:
...
   | sed \
       -e <sedprog1>
       -e <sedprog2>
...
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-15  Tom de Vries  <tdevries@suse.de>

	* contrib/words.sh: Combine sed invocations.

Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
---
M gdb/contrib/words.sh
1 file changed, 6 insertions(+), 5 deletions(-)



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) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
Gerrit-Change-Number: 653
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [review] [gdb/contrib] Combine sed invocations in words.sh script
  2019-11-15  9:53 [review] [gdb/contrib] Combine sed invocations in words.sh script Tom de Vries (Code Review)
@ 2019-11-22  3:27 ` Kevin Buettner (Code Review)
  2019-11-22 15:24 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-11-22 15:24 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Buettner (Code Review) @ 2019-11-22  3:27 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

Kevin Buettner has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/653
......................................................................


Patch Set 1: Code-Review+2

LGTM.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
Gerrit-Change-Number: 653
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Kevin Buettner <kevinb@redhat.com>
Gerrit-Comment-Date: Fri, 22 Nov 2019 03:27:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] [gdb/contrib] Combine sed invocations in words.sh script
  2019-11-15  9:53 [review] [gdb/contrib] Combine sed invocations in words.sh script Tom de Vries (Code Review)
  2019-11-22  3:27 ` Kevin Buettner (Code Review)
@ 2019-11-22 15:24 ` Sourceware to Gerrit sync (Code Review)
  2019-11-22 15:24 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-22 15:24 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Kevin Buettner

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 <sedprog1>
   | sed <sedprog2>
...
into this:
...
   | sed \
       -e <sedprog1>
       -e <sedprog2>
...
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  <tdevries@suse.de>

	* 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  <tdevries@suse.de>
+
+	* contrib/words.sh: Combine sed invocations.
+
 2019-11-21  Christian Biesinger  <cbiesinger@google.com>
 
 	* 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) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
Gerrit-Change-Number: 653
Gerrit-PatchSet: 2
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Kevin Buettner <kevinb@redhat.com>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] [gdb/contrib] Combine sed invocations in words.sh script
  2019-11-15  9:53 [review] [gdb/contrib] Combine sed invocations in words.sh script Tom de Vries (Code Review)
  2019-11-22  3:27 ` Kevin Buettner (Code Review)
  2019-11-22 15:24 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-11-22 15:24 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-22 15:24 UTC (permalink / raw)
  To: Tom de Vries, Kevin Buettner, gdb-patches

The original change was created by Tom de Vries.

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 <sedprog1>
   | sed <sedprog2>
...
into this:
...
   | sed \
       -e <sedprog1>
       -e <sedprog2>
...
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  <tdevries@suse.de>

	* 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  <tdevries@suse.de>
+
+	* contrib/words.sh: Combine sed invocations.
+
 2019-11-21  Christian Biesinger  <cbiesinger@google.com>
 
 	* 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) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
Gerrit-Change-Number: 653
Gerrit-PatchSet: 2
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Kevin Buettner <kevinb@redhat.com>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-22 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15  9:53 [review] [gdb/contrib] Combine sed invocations in words.sh script Tom de Vries (Code Review)
2019-11-22  3:27 ` Kevin Buettner (Code Review)
2019-11-22 15:24 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-22 15:24 ` Sourceware to Gerrit sync (Code Review)

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 read-only IMAP folder(s) and NNTP newsgroup(s).