> On Nov 24, 2015, at 1:11 PM, Yann Ylavic <ylavic....@gmail.com> wrote: > > On Tue, Nov 24, 2015 at 7:03 PM, Jim Jagielski <j...@jagunet.com> wrote: >> >>> On Nov 24, 2015, at 11:18 AM, Graham Leggett <minf...@sharp.fm> wrote: >>> >>> On 24 Nov 2015, at 6:15 PM, Yann Ylavic <ylavic....@gmail.com> wrote: >>> >>>> Not sure: >>>> if (!strcmp(h, "max-age") >>>> || ap_cmpcasestr(h, "max-age")) >>>> is likely to be a bit faster than a single ap_cmpcasestr() when it >>>> matches, but much slower when it does not. >>> >>> Yep, that’s the point. >>> >>> The vast majority of comparisons are lowercase for tokens like this. Might >>> as well test that fast path first before testing the worst case scenario. >>> >> >> Is there REALLY that much of a diff between >> >> if (ucharmap[*ps1] != ucharmap[*ps2]) { >> >> and >> >> if (*ps1 != *ps2) { >> >> to muddle up the code like that though?? > > The test from the other thread including str[n]cmp() says: > > $ for i in `seq 0 3`; do > ./newtest $i 150000000 \ > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa \ > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa \ > 0 > done > - str[n]casecmp (nb=150000000, len=0) > time = 8.435895804 : res = 0 > - ap_casecmpstr[n] (nb=150000000, len=0) > time = 8.207019751 : res = 0 > - ap_casecmpstr[n] w/ index (nb=150000000, len=0) > time = 4.429462481 : res = 0 > - str[n]cmp (nb=150000000, len=0) > time = 1.923039981 : res = 0 > > So strcmp() is really fast, since it probably advances word per word...
Yeah, likely just memcmp()