[Bug string/23709] New: glibc 2.27 lacks sse2 optimized strstr()

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] New: glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

            Bug ID: 23709
           Summary: glibc 2.27 lacks sse2 optimized strstr()
           Product: glibc
           Version: 2.27
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: paul.borile at gmail dot com
  Target Milestone: ---

Hi,
looks like code using strstr() and libc-2.27 is running 4 times slower than was
with libc-2.23. Having a look at profiled code executed in various moments show
different versions of strstr :

- libc-2.27.so: strstr.c, str-two-way.h - this is current version ubuntu
18.04.1

Same code, profiled March 13, 2018 :

- libc-2.23.so: strstr-sse2-unaligned.S - this version was 4 times faster

Was the sse2 optimized code removed from strstr() in 2.27 ? Any plans to
reintroduce it ?

-Paul

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #3 from Andreas Schwab <[hidden email]> ---
How did you compile it?

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2018-09-25
                 CC|                            |fweimer at redhat dot com
     Ever confirmed|0                           |1
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
glibc 2.27 on Fedora 28 x86_64 selects __strstr_sse2.

What's your architecture, and which CPU do you use?

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #2 from paul.borile at gmail dot com ---
ubuntu 18.04.1 LTS, Intel Core i7-4710HQ

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #4 from paul.borile at gmail dot com ---
Just using the standard libc installed on ubuntu 18.04

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #5 from Andreas Schwab <[hidden email]> ---
You need to report that to ubuntu then.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #6 from paul.borile at gmail dot com ---
already submitted but no answer. Thanks for clarifying that strstr() _should_
have sse 2 optimizations.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #7 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to paul.borile from comment #2)
> ubuntu 18.04.1 LTS, Intel Core i7-4710HQ

i386 or amd64?

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #8 from paul.borile at gmail dot com ---
amd64

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #9 from Florian Weimer <fweimer at redhat dot com> ---
Okay, then Ubuntu must have a peculiar build.  You need to report it to them.

As I said, on a Core i7-4810MQ, other builds of glibc 2.27 select an
SSE2-optimized version of strstr.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://launchpad.net/bugs/
                   |                            |1793786

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #10 from Florian Weimer <fweimer at redhat dot com> ---
I looked at the Ubuntu patches, but couldn't find anything obvious.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #11 from paul.borile at gmail dot com ---
Created attachment 11315
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11315&action=edit
strstr.c

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

paul.borile at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #13 from paul.borile at gmail dot com ---
debian buster (libc-2.27) has the same problem, debian 9 (libc-2.24) does not

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #14 from paul.borile at gmail dot com ---
fedora 27 and 26 are showing the same problema, fedora 25 is ok :


$ docker run -i fedora:27 /bin/bash -c "cat > strstr ; chmod +x strstr ; time
./strstr aa" < ./strstr
Unable to find image 'fedora:27' locally
27: Pulling from library/fedora
c8ae8b35783e: Pull complete
Digest: sha256:f4fb457f7cd858e0f6efa1a78390622823e83c393981b0bf91a2b6e8da3b6f50
Status: Downloaded newer image for fedora:27
matches = 3000000

real    0m4.939s
user    0m4.937s
sys     0m0.000s

$ docker run -i fedora:26 /bin/bash -c "cat > strstr ; chmod +x strstr ; time
./strstr aa" < ./strstr
Unable to find image 'fedora:26' locally
26: Pulling from library/fedora
df75b105d67a: Pull complete
Digest: sha256:b05007bacf64401663ab5d9a97d73b143a561be74a36a0f31219e5acb87fc7ec
Status: Downloaded newer image for fedora:26
matches = 3000000

real    0m4.426s
user    0m4.426s
sys     0m0.000s

$ docker run -i fedora:25 /bin/bash -c "cat > strstr ; chmod +x strstr ; time
./strstr aa" < ./strstr
Unable to find image 'fedora:25' locally
25: Pulling from library/fedora
8ab017634520: Pull complete
Digest: sha256:322cb01bbca26972c98051bacd3ab8555cec059496d64d35ee78b15de9ea0d06
Status: Downloaded newer image for fedora:25
matches = 3000000

real    0m0.468s
user    0m0.468s
sys     0m0.000s

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #15 from Andreas Schwab <[hidden email]> ---
Cannot reproduce on openSUSE Tumbleweed.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #12 from paul.borile at gmail dot com ---
I made a test compiling for amd64 the attached program and running it on
different platforms. The test run in 0.5 seconds on a sse2 optimized strstr()
while 8 times slower on a non sse2 optimized strstr(). Example of a fast run :

$ docker run -i ubuntu:16.04 /bin/bash -c "cat > strstr ; chmod +x strstr ;
time ./strstr aa" < ./strstr
Unable to find image 'ubuntu:16.04' locally
16.04: Pulling from library/ubuntu
3b37166ec614: Pull complete
504facff238f: Pull complete
ebbcacd28e10: Pull complete
c7fb3351ecad: Pull complete
2e3debadcbf7: Pull complete
Digest: sha256:45ddfa61744947b0b8f7f20b8de70cbcdd441a6a0532f791fd4c09f5e491a8eb
Status: Downloaded newer image for ubuntu:16.04

real    0m0.475s
user    0m0.474s
sys     0m0.000s
matches = 3000000

Example of a slow run :

docker run -i ubuntu:18.04 /bin/bash -c "cat > strstr ; chmod +x strstr ; time
./strstr aa" < ./strstr
Unable to find image 'ubuntu:18.04' locally
18.04: Pulling from library/ubuntu
Digest: sha256:de774a3145f7ca4f0bd144c7d4ffb2931e06634f11529653b23eba85aef8e378
Status: Downloaded newer image for ubuntu:18.04
matches = 3000000

real    0m4.796s
user    0m4.794s
sys     0m0.000s

debian buster is showing the same problem :

docker run -i debian:buster /bin/bash -c "cat > strstr ; chmod +x strstr ; time
./strstr aa" < ./strstr
Unable to find image 'debian:buster' locally
buster: Pulling from library/debian
1064a561889d: Pull complete
Digest: sha256:b17f0ca6c2c0c5ad88b3a292e50ad657c87fc165ef1bde4dba57d9616651a9b9
Status: Downloaded newer image for debian:buster
matches = 3000000

real    0m4.871s
user    0m4.871s
sys     0m0.000s

So it is not an ubuntu 18 only problem.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #16 from paul.borile at gmail dot com ---
opensuse:42.3 (libc-2.22) does not have the problem. Seems that it was
introduced in libc-2.25 (fedora26 has it).


$ docker run -i opensuse:42.3 /bin/bash -c "cat > strstr ; chmod +x strstr ;
time ./strstr aa" < ./strstr
Unable to find image 'opensuse:42.3' locally
42.3: Pulling from library/opensuse
47aa660240a8: Pull complete
Digest: sha256:569e6ee7a622838b9fa1111c3bfa99a50fdb34b7503f945b7d18ce66bb94a369
Status: Downloaded newer image for opensuse:42.3
matches = 3000000

real    0m0.450s
user    0m0.450s
sys     0m0.000s

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.25 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #19 from paul.borile at gmail dot com ---
Created attachment 11318
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11318&action=edit
strstr executable

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug string/23709] glibc 2.27 lacks sse2 optimized strstr()

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23709

--- Comment #17 from paul.borile at gmail dot com ---
opensuse:42.3 (libc-2.22) does not have the problem. Seems that it was
introduced in libc-2.25 (fedora26 has it).


$ docker run -i opensuse:42.3 /bin/bash -c "cat > strstr ; chmod +x strstr ;
time ./strstr aa" < ./strstr
Unable to find image 'opensuse:42.3' locally
42.3: Pulling from library/opensuse
47aa660240a8: Pull complete
Digest: sha256:569e6ee7a622838b9fa1111c3bfa99a50fdb34b7503f945b7d18ce66bb94a369
Status: Downloaded newer image for opensuse:42.3
matches = 3000000

real    0m0.450s
user    0m0.450s
sys     0m0.000s

--
You are receiving this mail because:
You are on the CC list for the bug.
12