From patchwork Thu Jul 16 19:55:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Bilka X-Patchwork-Id: 7729 Received: (qmail 54929 invoked by alias); 16 Jul 2015 20:02:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 54911 invoked by uid 89); 16 Jul 2015 20:02:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: popelka.ms.mff.cuni.cz Date: Thu, 16 Jul 2015 21:55:38 +0200 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: Carlos O'Donell Cc: Tulio Magno Quites Machado Filho , GNU C Library , Steve Munroe , Rajalakshmi Srinivasaraghavan Subject: Re: [PATCH v3] powerpc: strstr optimization Message-ID: <20150716195538.GA5140@domone> References: <558A5642.5020107@linux.vnet.ibm.com> <558A5761.2000409@linux.vnet.ibm.com> <87oajpm8nc.fsf@totoro.br.ibm.com> <871tgijuri.fsf@linux.vnet.ibm.com> <55A6FE3F.6090701@redhat.com> <55A70B70.6090607@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55A70B70.6090607@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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) {