Re: [Patch] faster fnmatch

2009-05-08 Thread Ondrej Bilka
Hello I finished writing this patch. I added test(and fnmatchcomp.m4 which I forgot in previous). I didnt change much, prettied and fixed bugs discovered by tests. Now it should be stable. I hope this patch looks OK. Moreover I made two independent changes first is preallocating buffer in fnma

Re: [Patch] faster fnmatch

2009-05-02 Thread Ondrej Bilka
Hello Ralf, On Fri, May 01, 2009 at 09:50:23PM +0200, Ralf Wildenhues wrote: > That NULTEST thing is cute but makes me cringe. If the second malloc > runs out of memory, then you return, but leak memory from the first > malloc. So in a tight memory situation, your code starts contributing > to t

Re: [Patch] faster fnmatch

2009-05-01 Thread Ralf Wildenhues
Hello Ondrej, * Ondrej Bilka wrote on Fri, May 01, 2009 at 09:36:39PM CEST: > +#define NULTEST(...) if (__builtin_expect(!(__VA_ARGS__),0)) return NULL; > +#define NULTEST2(...) if (__builtin_expect(!(__VA_ARGS__),0)) return -1; [...] > +static fnmatch_state * > +initfnmatchstate () > +{ > + fn

Re: [Patch] faster fnmatch

2009-05-01 Thread Ondrej Bilka
I send new version according to your comments On Fri, May 01, 2009 at 02:51:48PM +0200, Bruno Haible wrote: > > Hmm, well, users are expecting a speedup through your module always. If it > some (not too rare) cases the glibc fnmatch is faster, it's difficult to > convince people to use your functio

Re: [Patch] faster fnmatch

2009-05-01 Thread Bruno Haible
Hello Ondrej, Nice work already! > *abc* > en_US.UTF-8 > user: 2.71 > user: 0.23 > ... > *ab[a-z]* > en_US.UTF-8 > user: 2.85 > user: 3.32 > C > user: 0.86 > user: 1.25 Hmm, well, users are expecting a speedup through your module always. If it some (not too rare) cases the glibc fnmatch is

Re: [Patch] faster fnmatch

2009-05-01 Thread Ralf Wildenhues
Hello Ondrej, * Ondrej Bilka wrote on Thu, Apr 30, 2009 at 10:41:49PM CEST: > I here attach compiled fnmatch I wrote as gnulib module. I haven't read your patch closely, but it fails to check the return value from all of the malloc/realloc... functions, opening up several opportunities for segme

[Patch] faster fnmatch

2009-04-30 Thread Ondrej Bilka
Hello I here attach compiled fnmatch I wrote as gnulib module. It always should give same answer as fnmatch. Still I assume UTF8 or singlebyte encoding otherwise I fallback. I could generalize this to wide characters but if I dont know any character is single wchar I cannot do much (UTF16 wchar i