From: Junio C Hamano Date: Sun, 26 Oct 2025 23:29:40 GMT Subject: Re: [PATCH] match_pathname(): give fnmatch one char of prefix context Message-ID: In-Reply-To: <20251026152614.GB2095501@coredump.intra.peff.net> Jeff King writes: > I also wonder how expensive that memcmp() is. ;) Obviously not very, but > if the point is that we are trying to save fnmatch from looking at that > one extra character, we already pinching pennies in a mostly > un-measurable way. I added the "limit to known bad case" in the illustration not for performance but for correctness. This was because just like we weren't convinced that the "**/" may be the only case that breaks the existing optimization, I was worried if stepping back by one byte may somehow make a pattern that should not match mistakenly match. In any case, your numbers did make sense and tells us that optimized strncmp() is much faster than comparing a byte at a time, which is expected. Thanks.