public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr
@ 2015-06-04  7:59 neleai at seznam dot cz
  2020-03-24 17:24 ` [Bug libstdc++/66414] " hiraditya at msn dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: neleai at seznam dot cz @ 2015-06-04  7:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

            Bug ID: 66414
           Summary: Regression: string::find ten times slower than strstr
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neleai at seznam dot cz
  Target Milestone: ---

Hi, as I seen bug with string::== being slower than using strcmp I decided to
check other functions for regressions. Here string::find doesn't simply call
optimized strstr and as result its ten times slower in following benchmark on
my sandy bridge.


#include <cstring>
#include <cstdlib>
#include <string>
using namespace std;

int
main()
{
  int i;
  char s[10000];
  for (i = 0; i < 10000; i++)
    s[i] = ((unsigned) rand() % 128) + 1;
  s[9999] = 0;
  int sum = 0;
  std::string foo = s;
  std::string bar;
  char *needle = strdup("needle");

  for (i = 0; i < 100000; i++)
    {
      needle[0] = ((unsigned) rand() % 128) + 1;
#ifdef STRSTR
      sum += (long) strstr(s, needle);
#else
      sum += foo.find(needle);
#endif
    }
  return sum;
}


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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
@ 2020-03-24 17:24 ` hiraditya at msn dot com
  2021-01-27 13:34 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hiraditya at msn dot com @ 2020-03-24 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

AK <hiraditya at msn dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hiraditya at msn dot com

--- Comment #8 from AK <hiraditya at msn dot com> ---
Should we consider this fixed?

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
  2020-03-24 17:24 ` [Bug libstdc++/66414] " hiraditya at msn dot com
@ 2021-01-27 13:34 ` redi at gcc dot gnu.org
  2021-01-27 13:47 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-27 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to AK from comment #8)
> Should we consider this fixed?

I think we can still do better, by using GNU memmem when it's available:

https://gcc.gnu.org/pipermail/gcc-patches/2017-January/466460.html
https://gcc.gnu.org/pipermail/gcc-patches/2017-January/466469.html
https://gcc.gnu.org/pipermail/gcc-patches/2017-January/466471.html

For now we should also use the new code in basic_string_view::find which is
currently much slower.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
  2020-03-24 17:24 ` [Bug libstdc++/66414] " hiraditya at msn dot com
  2021-01-27 13:34 ` redi at gcc dot gnu.org
@ 2021-01-27 13:47 ` cvs-commit at gcc dot gnu.org
  2023-09-11 17:03 ` scc at teamt5 dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-27 13:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:a199da782fc165fd45f42a15cc9020994efd455d

commit r11-6931-ga199da782fc165fd45f42a15cc9020994efd455d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jan 27 13:21:52 2021 +0000

    libstdc++: Optimize std::string_view::find [PR 66414]

    This reuses the code from std::string::find, which was improved by
    r244225, but string_view was not changed to match.

    libstdc++-v3/ChangeLog:

            PR libstdc++/66414
            * include/bits/string_view.tcc
            (basic_string_view::find(const CharT*, size_type, size_type)):
            Optimize.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (2 preceding siblings ...)
  2021-01-27 13:47 ` cvs-commit at gcc dot gnu.org
@ 2023-09-11 17:03 ` scc at teamt5 dot org
  2023-09-11 17:03 ` scc at teamt5 dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: scc at teamt5 dot org @ 2023-09-11 17:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

Chih-Hsuan Yang <scc at teamt5 dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scc at teamt5 dot org

--- Comment #11 from Chih-Hsuan Yang <scc at teamt5 dot org> ---
Hi all, 

I hope this message finds you well.

I wanted to inquire about the current status of our project. It has come to my
attention that our program is facing performance issues when using gcc 13.2.
Considering this situation, I am willing to take on the responsibility of
addressing this issue by taking ownership of the related ticket.

Could you please provide an update on the progress here?

Thank you for your attention to this matter.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (3 preceding siblings ...)
  2023-09-11 17:03 ` scc at teamt5 dot org
@ 2023-09-11 17:03 ` scc at teamt5 dot org
  2023-09-11 17:04 ` scc at teamt5 dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: scc at teamt5 dot org @ 2023-09-11 17:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #12 from Chih-Hsuan Yang <scc at teamt5 dot org> ---
Hi all,


I hope this message finds you well.

I wanted to inquire about the current status of our project. It has come to my
attention that our program is facing performance issues when using gcc 13.2.
Considering this situation, I am willing to take on the responsibility of
addressing this issue by taking ownership of the related ticket.

Could you please provide an update on the progress here?

Thank you for your attention to this matter.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (4 preceding siblings ...)
  2023-09-11 17:03 ` scc at teamt5 dot org
@ 2023-09-11 17:04 ` scc at teamt5 dot org
  2023-09-11 17:22 ` scc at teamt5 dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: scc at teamt5 dot org @ 2023-09-11 17:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #13 from Chih-Hsuan Yang <scc at teamt5 dot org> ---
Hi all,


I hope this message finds you well.

I wanted to inquire about the current status of our project. It has come to my
attention that our program is facing performance issues when using gcc 13.2.
Considering this situation, I am willing to take on the responsibility of
addressing this issue by taking ownership of the related ticket.

Could you please provide an update on the progress here?

Thank you for your attention to this matter.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (5 preceding siblings ...)
  2023-09-11 17:04 ` scc at teamt5 dot org
@ 2023-09-11 17:22 ` scc at teamt5 dot org
  2023-09-11 19:09 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: scc at teamt5 dot org @ 2023-09-11 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #14 from Chih-Hsuan Yang <scc at teamt5 dot org> ---
(In reply to Chih-Hsuan Yang from comment #11)
> Hi all, 
> 
> I hope this message finds you well.
> 
> I wanted to inquire about the current status of our project. It has come to
> my attention that our program is facing performance issues when using gcc
> 13.2. Considering this situation, I am willing to take on the responsibility
> of addressing this issue by taking ownership of the related ticket.
> 
> Could you please provide an update on the progress here?
> 
> Thank you for your attention to this matter.

sorry, it's my fault, it seems being solved.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (6 preceding siblings ...)
  2023-09-11 17:22 ` scc at teamt5 dot org
@ 2023-09-11 19:09 ` redi at gcc dot gnu.org
  2023-09-12  2:55 ` scc at teamt5 dot org
  2023-09-12  7:31 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-11 19:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Chih-Hsuan Yang from comment #11)
> Could you please provide an update on the progress here?


All progress is already recorded above.

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (7 preceding siblings ...)
  2023-09-11 19:09 ` redi at gcc dot gnu.org
@ 2023-09-12  2:55 ` scc at teamt5 dot org
  2023-09-12  7:31 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: scc at teamt5 dot org @ 2023-09-12  2:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #16 from Chih-Hsuan Yang <scc at teamt5 dot org> ---
(In reply to Jonathan Wakely from comment #15)
> (In reply to Chih-Hsuan Yang from comment #11)
> > Could you please provide an update on the progress here?
> 
> 
> All progress is already recorded above.

Would you like to change this ticket's status to close? And marking this issue
is solved since gcc 10.1, libstdc++6.0.28

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

* [Bug libstdc++/66414] string::find ten times slower than strstr
  2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
                   ` (8 preceding siblings ...)
  2023-09-12  2:55 ` scc at teamt5 dot org
@ 2023-09-12  7:31 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-12  7:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66414

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
See comment 9

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

end of thread, other threads:[~2023-09-12  7:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04  7:59 [Bug libstdc++/66414] New: Regression: string::find ten times slower than strstr neleai at seznam dot cz
2020-03-24 17:24 ` [Bug libstdc++/66414] " hiraditya at msn dot com
2021-01-27 13:34 ` redi at gcc dot gnu.org
2021-01-27 13:47 ` cvs-commit at gcc dot gnu.org
2023-09-11 17:03 ` scc at teamt5 dot org
2023-09-11 17:03 ` scc at teamt5 dot org
2023-09-11 17:04 ` scc at teamt5 dot org
2023-09-11 17:22 ` scc at teamt5 dot org
2023-09-11 19:09 ` redi at gcc dot gnu.org
2023-09-12  2:55 ` scc at teamt5 dot org
2023-09-12  7:31 ` redi 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).