Look at other parts in the code, a nice idea is to compare character by
character until the string is an ASCII one, as soon as we detect a non
ascii character we revert to the standard method and re-compare the
strings, Tridge has gained very good optimizations with this twchnique.

Simo.

On Tue, 2003-02-18 at 01:35, Martin Pool wrote:
> On 18 Feb 2003, Andrew Bartlett <[EMAIL PROTECTED]> wrote:
> 
> > Possibly only for long strings?  But then that is probably
> > micro-optimization.  
> 
> If we really cared about optimizing this function, then we would
> compare character-by-character rather than converting both strings to
> uppercase first.  This is a bit hard for some wierd encodings I know,
> but it ought to be possible to do it in charcnv.c.
> 
> The case where we compare, for example, a thousand-character string to
> the empty string is ridiculously slow at the moment.
> 
> I don't know if this is a problem for Samba overall or not, so I'm not
> touching it at the moment.
> 
>       int StrCaseCmp(const char *s, const char *t)
>       {
>               pstring buf1, buf2;
>               unix_strupper(s, strlen(s)+1, buf1, sizeof(buf1));
>               unix_strupper(t, strlen(t)+1, buf2, sizeof(buf2));
>               return strcmp(buf1,buf2);
>       }
-- 
Simo Sorce - [EMAIL PROTECTED]
Xsec s.r.l.
via Durando 10 Ed. G - 20158 - Milano
tel. +39 02 2399 7130 - fax: +39 02 700 442 399

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to