On Wed, Mar 13, 2013 at 3:59 AM, Junio C Hamano wrote:
>>> strncmp is provided length information which could be taken advantage
>>> by the underlying implementation.
>
> After all, strcmp() could also be optimized to fetch word-at-a-time
> while being careful about not overstepping the page bound
Duy Nguyen writes:
> glibc's C strncmp version does 4-byte comparison at a time when n >=4,
> then fall back to 1-byte for the rest. I don't know if it's faster
> than a plain always 1-byte comparison though. There's also the hand
> written assembly version that compares n from 1..16, not exactly
On Sun, Mar 10, 2013 at 7:11 PM, Antoine Pelisse wrote:
>>> By the way, if we know the length of the string, we could use memcmp.
>>> This one is allowed to compare 4-bytes at a time (he doesn't care
>>> about end of string). This is true because the value of the length
>>> parameter is no longer
>> By the way, if we know the length of the string, we could use memcmp.
>> This one is allowed to compare 4-bytes at a time (he doesn't care
>> about end of string). This is true because the value of the length
>> parameter is no longer "at most".
>
> We still need to worry about access violation
On Sun, Mar 10, 2013 at 6:54 PM, Antoine Pelisse wrote:
> On Sun, Mar 10, 2013 at 12:43 PM, Antoine Pelisse wrote:
>> On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen wrote:
>>> glibc's C strncmp version does 4-byte comparison at a time when n >=4,
>>> then fall back to 1-byte for the rest.
>>
>> Lo
On Sun, Mar 10, 2013 at 12:43 PM, Antoine Pelisse wrote:
> On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen wrote:
>> glibc's C strncmp version does 4-byte comparison at a time when n >=4,
>> then fall back to 1-byte for the rest.
>
> Looking at this
> (http://fossies.org/dox/glibc-2.17/strncmp_8c_so
On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen wrote:
> glibc's C strncmp version does 4-byte comparison at a time when n >=4,
> then fall back to 1-byte for the rest.
Looking at this
(http://fossies.org/dox/glibc-2.17/strncmp_8c_source.html), it's not
exactly true.
It would rather be while (n >=
On Sun, Mar 10, 2013 at 2:34 PM, Junio C Hamano wrote:
> Nguyễn Thái Ngọc Duy writes:
>
>> strncmp is provided length information which could be taken advantage
>> by the underlying implementation.
>
> I may be missing something fundamental, but I somehow find the above
> does not make any sense
Nguyễn Thái Ngọc Duy writes:
> strncmp is provided length information which could be taken advantage
> by the underlying implementation.
I may be missing something fundamental, but I somehow find the above
does not make any sense.
strcmp(a, b) has to pay attention to NUL in these strings and s
9 matches
Mail list logo