Re: [PATCH v2 3/6] match_basename: use strncmp instead of strcmp
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Mar 13, 2013, 01:11 UTC
- Message-ID
- <CACsJy8DLDZqacrEZ4T0VkSr00wW2z6q-MsX0NKjcPhLdtgFV5Q@mail.gmail.com>
- In-Reply-To
- <7v7glc72rn.fsf@alter.siamese.dyndns.org>
On Wed, Mar 13, 2013 at 3:59 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
>>> 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 boundary.
It boils down to giving more information to the underlying implementation with hope that it can be useful for something. Although at this point I think strncmp vs strcmp vs memcmp may be not worth doing (we keep explicit length comparison to reduce *cmp calls though). The gain is relatively small and will become even smaller after we avoid running exclude on tracked files (which eliminates like 2/3 of the processed entries).
-- Duy