This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] powerpc: strstr optimization


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]