This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] powerpc: strstr optimization
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, GNU C Library <libc-alpha at sourceware dot org>, Steve Munroe <sjmunroe at us dot ibm dot com>, Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>
- Date: Thu, 16 Jul 2015 21:55:38 +0200
- Subject: Re: [PATCH v3] powerpc: strstr optimization
- Authentication-results: sourceware.org; auth=none
- References: <558A5642 dot 5020107 at linux dot vnet dot ibm dot com> <558A5761 dot 2000409 at linux dot vnet dot ibm dot com> <87oajpm8nc dot fsf at totoro dot br dot ibm dot com> <871tgijuri dot fsf at linux dot vnet dot ibm dot com> <55A6FE3F dot 6090701 at redhat dot com> <55A70B70 dot 6090607 at redhat dot com>
On Wed, Jul 15, 2015 at 09:40:00PM -0400, Carlos O'Donell wrote:
> On 07/15/2015 08:43 PM, Carlos O'Donell wrote:
> >> May I proceed with this commit?
> >
> > Yes, please commit this for 2.22.
>
> For the record I trust IBM to make sure these patches make incremental
> improvements in performance even if they are not the best possible
> performance as pointed out by Ondrej Bilka.
>
Sorry Carlos, your trust is misplaced. This patch wasn't reviewed at
all. I did that as test how much we could test IBM to verify patches.
I pointed out that it could have possibly quadratic behaviour which
still does. So please don't accept unreviewed patches next time.
As review I asked multiple times what is performance for
strstr("aaa...aaa","aaa...aaab") but I never got answer.
And answer is that there is indeed performance regression that causes
strstr to be 100 times slower. So if this was applied it should be
reverted.
I get following
simple_strstr stupid_strstr __strstr_power7
__strstr_ppc
strstr("aaa...aaa","aaa...aaab")
2.8543e+06 9.24296e+08 3.47783e+08 3.11846e+06
With following benchmark:
diff --git a/benchtests/bench-strstr.c b/benchtests/bench-strstr.c
index 74f3ee8..b758969 100644
--- a/benchtests/bench-strstr.c
+++ b/benchtests/bench-strstr.c
@@ -128,6 +128,23 @@ test_main (void)
printf ("\t%s", impl->name);
putchar ('\n');
+
+ char s1[1000000],s2[2000];
+
+ memset (s1, 'a', 1000000);
+ memset (s2, 'a', 2000);
+ s1[999999] = '\0';
+ s2[1998] = 'b';
+ s2[1999] = '\0';
+
+ {
+ printf ("strstr(\"aaa...aaa\",\"aaa...aaab\"\n");
+ FOR_EACH_IMPL (impl, 0)
+ do_one_test (impl, s1, s2, NULL);
+ putchar('\n');
+ }
+
+
for (size_t klen = 2; klen < 32; ++klen)
for (size_t hlen = 2 * klen; hlen < 16 * klen; hlen += klen)
{