From: Dan McGee Date: Sat, 02 Apr 2011 17:54:39 GMT Subject: Re: [PATCH 5/5] tree-walk: match_entry microoptimization Message-ID: In-Reply-To: On Sat, Apr 2, 2011 at 4:06 AM, Nguyen Thai Ngoc Duy wrote: > On Thu, Mar 31, 2011 at 8:38 AM, Dan McGee wrote: >> Before calling strncmp(), see if we can get away with checking only the >> first character of the passed path components instead. >> >> Signed-off-by: Dan McGee > > I wonder if inlining strcmp() would be better (at least cleaner code). > It seems like you try to avoid the function call cost here. 100% agree with you, but I have no idea how to do that. Realize also you can use memcmp() here; I tried that and got no noticeable gain (likely due to how short these strings are). However, it is what we use in most other functions in this file. I assume the compiler would inline versions with a static length, but if you have suggestions as to how to inline a non-trivial version here I'm all ears. -Dan