Re: [PATCH] improve string find algorithm

2017-01-09 Thread Aditya K
Thanks, -Aditya From: Jonathan Wakely Sent: Monday, January 9, 2017 6:33 AM To: Aditya K Cc: Aditya Kumar; Sebastian Pop; libstd...@gcc.gnu.org; gcc-patches@gcc.gnu.org Subject: Re: [PATCH] improve string find algorithm   On 06/01/17 22:19 +, Aditya K wrote: >> Could you t

Re: [PATCH] improve string find algorithm

2017-01-09 Thread Jonathan Wakely
riday, January 6, 2017 2:37 PM To: Aditya Kumar Cc: libstd...@gcc.gnu.org; gcc-patches@gcc.gnu.org; hiradi...@msn.com Subject: Re: [PATCH] improve string find algorithm   On 06/01/17 14:34 -0600, Aditya Kumar wrote: Thanks for the correction and updating the comments. Could you try the corrected pat

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Aditya K
ns   2205 ns 315887 BM_StringRegression 109 ns    109 ns    6346500 -Aditya From: Jonathan Wakely Sent: Friday, January 6, 2017 2:37 PM To: Aditya Kumar Cc: libstd...@gcc.gnu.org; gcc-patches@gcc.gnu.org; hiradi...@msn.com Subject: Re: [PATCH] improve string f

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 20:32 +, Jonathan Wakely wrote: On 06/01/17 13:35 +, Jonathan Wakely wrote: I'm surprised we don't have any tests for this case, but apparently we don't, as your patch passes all our tests. My bad, we do have tests that FAIL with this patch, but only after a 'make clean' (o

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 14:34 -0600, Aditya Kumar wrote: Thanks for the correction and updating the comments. Could you try the corrected patch on your benchmarks? The performance with the patch is worse for the first string::find benchmark in our testsuite: s = "aabbaabbaaxd adbffdadgaxaabbbddhatyb

RE: [PATCH] improve string find algorithm

2017-01-06 Thread Aditya Kumar
string find algorithm On 06/01/17 08:42 -0600, Aditya Kumar wrote: >Yes, we do. >Sorry for the mistake, it happened because I first wrote this for >libcxx (https://reviews.llvm.org/D27068) and while porting that line >got missed. > >Thanks, >-Aditya > > >diff --g

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 13:35 +, Jonathan Wakely wrote: I'm surprised we don't have any tests for this case, but apparently we don't, as your patch passes all our tests. My bad, we do have tests that FAIL with this patch, but only after a 'make clean' (otherwise the explicit instantiation definitions i

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 08:42 -0600, Aditya Kumar wrote: Yes, we do. Sorry for the mistake, it happened because I first wrote this for libcxx (https://reviews.llvm.org/D27068) and while porting that line got missed. Thanks, -Aditya diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/inc

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jakub Jelinek
On Fri, Jan 06, 2017 at 03:34:22PM +, Jonathan Wakely wrote: > > The description of Two-Way algorithm is in > > http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260 > > Boyer-Moore in > > http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm > > And in std::boyer_moore

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 16:26 +0100, Jakub Jelinek wrote: On Fri, Jan 06, 2017 at 03:16:12PM +, Jonathan Wakely wrote: On 06/01/17 16:09 +0100, Jakub Jelinek wrote: > On Fri, Jan 06, 2017 at 08:42:15AM -0600, Aditya Kumar wrote: > > Yes, we do. > > Sorry for the mistake, it happened because I first wrot

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jakub Jelinek
On Fri, Jan 06, 2017 at 03:16:12PM +, Jonathan Wakely wrote: > On 06/01/17 16:09 +0100, Jakub Jelinek wrote: > > On Fri, Jan 06, 2017 at 08:42:15AM -0600, Aditya Kumar wrote: > > > Yes, we do. > > > Sorry for the mistake, it happened because I first wrote this for > > > libcxx (https://reviews.

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 06/01/17 16:09 +0100, Jakub Jelinek wrote: On Fri, Jan 06, 2017 at 08:42:15AM -0600, Aditya Kumar wrote: Yes, we do. Sorry for the mistake, it happened because I first wrote this for libcxx (https://reviews.llvm.org/D27068) and while porting that line got missed. Shouldn't find at least in

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jakub Jelinek
On Fri, Jan 06, 2017 at 08:42:15AM -0600, Aditya Kumar wrote: > Yes, we do. > Sorry for the mistake, it happened because I first wrote this for > libcxx (https://reviews.llvm.org/D27068) and while porting that line > got missed. Shouldn't find at least in the case where it is narrow char string ju

RE: [PATCH] improve string find algorithm

2017-01-06 Thread Aditya Kumar
cc.gnu.org; gcc-patches@gcc.gnu.org; hiradi...@msn.com Subject: Re: [PATCH] improve string find algorithm On 07/12/16 11:46 -0600, Aditya Kumar wrote: >Here is an improved version of basic_string::find. The idea is to >split the string find in two parts: >1. search for the first match by us

Re: [PATCH] improve string find algorithm

2017-01-06 Thread Jonathan Wakely
On 07/12/16 11:46 -0600, Aditya Kumar wrote: Here is an improved version of basic_string::find. The idea is to split the string find in two parts: 1. search for the first match by using traits_type::find (this gets converted to memchr for x86) 2. see if there is a match (this gets converted to m

Re: [PATCH] improve string find algorithm

2016-12-15 Thread Aditya K
Ping. From: Aditya Kumar Sent: Wednesday, December 7, 2016 11:46 AM To: libstd...@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org; hiradi...@msn.com; Aditya Kumar Subject: [PATCH] improve string find algorithm   Here is an improved version of basic_string::find. The idea is to split the string

Re: [PATCH] improve string find algorithm

2016-12-08 Thread Jonathan Wakely
On 07/12/16 11:46 -0600, Aditya Kumar wrote: Here is an improved version of basic_string::find. The idea is to split the string find in two parts: 1. search for the first match by using traits_type::find (this gets converted to memchr for x86) 2. see if there is a match (this gets converted to m

[PATCH] improve string find algorithm

2016-12-07 Thread Aditya Kumar
Here is an improved version of basic_string::find. The idea is to split the string find in two parts: 1. search for the first match by using traits_type::find (this gets converted to memchr for x86) 2. see if there is a match (this gets converted to memcmp for x86) Passes bootstrap on x86-64. Th