public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12100] New: QoI regression: strstr() slowed from O(n) to O(n^2) on SSE4 machines
@ 2010-10-06 18:11 eblake at redhat dot com
  2010-10-07  3:20 ` [Bug libc/12100] " drepper.fsp at gmail dot com
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: eblake at redhat dot com @ 2010-10-06 18:11 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12100

           Summary: QoI regression: strstr() slowed from O(n) to O(n^2) on
                    SSE4 machines
           Product: glibc
           Version: 2.11
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: eblake@redhat.com


In glibc 2.9, strstr() was rewritten from a quadratic to a linear algorithm. 
However, in glibc 2.11, an SSE4 assembly version was added which speeds up
searches over short needles, but re-introduces the quadratic behavior of long
needles.

The best approach would be to bound the SSE4 brute-force assembly
implementation to a maximum needle length (perhaps 8 or 32 bytes), and defer to
the linear algorithm for long needles.  This has the benefits of avoiding the
startup overhead inherent in the linear algorithm (the overhead is
proportionately worse the shorter the needle is), while avoiding the quadratic
scaling for large needles (which are statistically less common, but all the
more important to avoid scaling effects).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-08-20 19:53 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-06 18:11 [Bug libc/12100] New: QoI regression: strstr() slowed from O(n) to O(n^2) on SSE4 machines eblake at redhat dot com
2010-10-07  3:20 ` [Bug libc/12100] " drepper.fsp at gmail dot com
2012-05-18  2:50 ` hjl.tools at gmail dot com
2012-05-18  2:59 ` ppluzhnikov at google dot com
2012-05-18  3:11 ` bugdal at aerifal dot cx
2012-06-28 13:47 ` carlos_odonell at mentor dot com
2012-06-28 22:30 ` maxim.kuvyrkov at gmail dot com
2012-06-28 22:42 ` eblake at redhat dot com
2012-06-28 23:55 ` neleai at seznam dot cz
2012-06-29  0:02 ` eblake at redhat dot com
2012-06-29  0:10 ` bugdal at aerifal dot cx
2012-06-29 12:58 ` liubov.dmitrieva at gmail dot com
2012-06-29 13:07 ` bugdal at aerifal dot cx
2012-06-29 15:34 ` liubov.dmitrieva at gmail dot com
2012-12-03 23:56 ` carlos at systemhalted dot org
2012-12-11 11:48 ` hannes at stressinduktion dot org
2013-12-14 19:11 ` cvs-commit at gcc dot gnu.org
2013-12-18  4:48 ` allan at archlinux dot org
2014-01-30  7:20 ` siddhesh at redhat dot com
2014-02-16 19:32 ` jackie.rosen at hushmail dot com
2014-05-28 19:42 ` schwab at sourceware dot org
2014-06-13  8:51 ` fweimer at redhat dot com
2015-08-20 19:53 ` cvs-commit at gcc dot gnu.org

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