public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Improve generic strspn/strcspn/strpbrk
@ 2016-03-28 15:20 Adhemerval Zanella
  2016-03-28 15:20 ` [PATCH 3/4] Improve generic strpbrk performance Adhemerval Zanella
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Adhemerval Zanella @ 2016-03-28 15:20 UTC (permalink / raw)
  To: libc-alpha

This is a followup on previous Wilco patch [1] to optimize strcspn
that also optimizes the generic strspn and strpbrk.  I used the
same strategy Wilco has used on strcspn for strspn and rewrote
strpbrk to just use strcspn instead.

I also tried to play with compiler options to check if it could
omit the memset call generation when initializing the lookup
table, but without success.  This is a similar strategy I used
on powerpc64 str{c}spn optimization.

Wilco initial approach was to remove the __strcspn_c{1,2,3}
inline function in string2.h header, however they are part of
ABI (to support compilers that do not inline the calls) and it
is not safe to remove then.  I have added it back, although the
strcspn new macro does not uses them and I also used the same
strategy for both strspn and strpbrk.

Performance-wise the algorithm is similar with current optimized
assembly one already in GLIBC (x86 and powerpc).  In fact, for
powerpc64 the algorithm performance is similar to assembly
routines which lead me to remove them.  i686 default one
is slight faster, while the SSE4.1 variant shows much better
performance (through the use of SIMD instructions).

[1] https://sourceware.org/ml/libc-alpha/2016-01/msg00173.html

Adhemerval Zanella (3):
  Improve generic strspn performance
  Improve generic strpbrk performance
  Remove powerpc64 strspn, strcspn, and strpbrk implementation

Wilco Dijkstra (1):
  Improve generic strcspn performance

 ChangeLog                           |  18 +++++
 string/bits/string2.h               | 123 +++++-------------------------
 string/strcspn.c                    |  44 +++++++++--
 string/strpbrk.c                    |  12 +--
 string/strspn.c                     |  56 ++++++++++----
 sysdeps/powerpc/powerpc64/strcspn.S | 127 -------------------------------
 sysdeps/powerpc/powerpc64/strpbrk.S | 135 ---------------------------------
 sysdeps/powerpc/powerpc64/strspn.S  | 144 ------------------------------------
 8 files changed, 115 insertions(+), 544 deletions(-)
 delete mode 100644 sysdeps/powerpc/powerpc64/strcspn.S
 delete mode 100644 sysdeps/powerpc/powerpc64/strpbrk.S
 delete mode 100644 sysdeps/powerpc/powerpc64/strspn.S

-- 
1.9.1

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 0/4] Improve generic strspn/strcspn/strpbrk
@ 2016-03-31 14:01 Adhemerval Zanella
  2016-03-31 14:01 ` [PATCH 1/4] Improve generic strcspn performance Adhemerval Zanella
  0 siblings, 1 reply; 24+ messages in thread
From: Adhemerval Zanella @ 2016-03-31 14:01 UTC (permalink / raw)
  To: libc-alpha

Changes from previous version:

 * Add some optimization on strspn implementation from Wilco
   comments.

 * Move the inline __str{spn,cspn,brk}_* symbol from the string2.h
   header to string-inlike and added compatibility version since
   they will not be generated anymore.

---


This is a followup on previous Wilco patch [1] to optimize strcspn
that also optimizes the generic strspn and strpbrk.  I used the
same strategy Wilco has used on strcspn for strspn and rewrote
strpbrk to just use strcspn instead.

I also tried to play with compiler options to check if it could
omit the memset call generation when initializing the lookup
table, but without success.  This is a similar strategy I used
on powerpc64 str{c}spn optimization.

Wilco initial approach was to remove the __strcspn_c{1,2,3}
inline function in string2.h header, however they are part of
ABI (to support compilers that do not inline the calls) and it
is not safe to remove then.  I have added it back, although the
strcspn new macro does not uses them and I also used the same
strategy for both strspn and strpbrk.

Performance-wise the algorithm is similar with current optimized
assembly one already in GLIBC (x86 and powerpc).  In fact, for
powerpc64 the algorithm performance is similar to assembly
routines which lead me to remove them.  i686 default one
is slight faster, while the SSE4.1 variant shows much better
performance (through the use of SIMD instructions).

[1] https://sourceware.org/ml/libc-alpha/2016-01/msg00173.html

Adhemerval Zanella (3):
  Improve generic strspn performance
  Improve generic strpbrk performance
  Remove powerpc64 strspn, strcspn, and strpbrk implementation

Wilco Dijkstra (1):
  Improve generic strcspn performance

 ChangeLog                           |  46 ++++++++
 string/Versions                     |   2 +
 string/bits/string2.h               | 208 ++----------------------------------
 string/strcspn.c                    |  44 ++++++--
 string/string-inlines.c             |  97 +++++++++++++++++
 string/strpbrk.c                    |  12 +--
 string/strspn.c                     |  54 +++++++---
 sysdeps/i386/string-inlines.c       |  19 +---
 sysdeps/powerpc/powerpc64/strcspn.S | 127 ----------------------
 sysdeps/powerpc/powerpc64/strpbrk.S | 135 -----------------------
 sysdeps/powerpc/powerpc64/strspn.S  | 144 -------------------------
 11 files changed, 233 insertions(+), 655 deletions(-)
 delete mode 100644 sysdeps/powerpc/powerpc64/strcspn.S
 delete mode 100644 sysdeps/powerpc/powerpc64/strpbrk.S
 delete mode 100644 sysdeps/powerpc/powerpc64/strspn.S

-- 
1.9.1

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

end of thread, other threads:[~2016-04-01 20:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 15:20 [PATCH 0/4] Improve generic strspn/strcspn/strpbrk Adhemerval Zanella
2016-03-28 15:20 ` [PATCH 3/4] Improve generic strpbrk performance Adhemerval Zanella
2016-03-28 15:20 ` [PATCH 1/4] Improve generic strcspn performance Adhemerval Zanella
2016-03-29 13:02   ` [PATCH 2/4] Improve generic strspn performance Wilco Dijkstra
2016-03-29 14:08     ` Adhemerval Zanella
2016-03-30 17:47   ` [PATCH 1/4] Improve generic strcspn performance Richard Henderson
2016-03-30 18:01     ` Wilco Dijkstra
2016-03-30 18:24       ` Adhemerval Zanella
2016-03-30 18:46       ` Richard Henderson
2016-03-31 17:00   ` Richard Henderson
2016-04-01 20:44     ` Roland McGrath
2016-03-28 15:20 ` [PATCH 2/4] Improve generic strspn performance Adhemerval Zanella
2016-03-29 20:32   ` Tulio Magno Quites Machado Filho
2016-03-28 15:20 ` [PATCH 4/4] Remove powerpc64 strspn, strcspn, and strpbrk implementation Adhemerval Zanella
2016-03-28 16:10   ` Paul E. Murphy
2016-03-28 17:56     ` Adhemerval Zanella
2016-03-30 13:14   ` Tulio Magno Quites Machado Filho
2016-03-30 17:06     ` Adhemerval Zanella
2016-03-30 18:14       ` Tulio Magno Quites Machado Filho
2016-03-30 19:57         ` Adhemerval Zanella
2016-03-30 21:45           ` Tulio Magno Quites Machado Filho
2016-03-31 14:01 [PATCH 0/4] Improve generic strspn/strcspn/strpbrk Adhemerval Zanella
2016-03-31 14:01 ` [PATCH 1/4] Improve generic strcspn performance Adhemerval Zanella
2016-03-31 14:49   ` Wilco Dijkstra
2016-03-31 18:28     ` Adhemerval Zanella

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