From: Jeff Hostetler Date: Tue, 17 May 2022 20:17:39 GMT Subject: Re: [PATCH v6 20/28] fsmonitor: optimize processing of directory events Message-ID: In-Reply-To: On 5/12/22 11:08 AM, Johannes Schindelin wrote: > Hi Jeff, > > On Fri, 22 Apr 2022, Jeff Hostetler via GitGitGadget wrote: > >> From: Jeff Hostetler >> >> Teach Git to perform binary search over the cache-entries for a directory >> notification and then linearly scan forward to find the immediate children. >> [...] >> static void fsmonitor_refresh_callback(struct index_state *istate, char *name) >> { >> int i, len = strlen(name); >> - if (name[len - 1] == '/') { >> + int pos = index_name_pos(istate, name, len); >> + >> + trace_printf_key(&trace_fsmonitor, >> + "fsmonitor_refresh_callback '%s' (pos %d)", >> + name, pos); >> [...] >> + if (name[len - 1] == '/') { [...] >> } >> @@ -215,7 +253,6 @@ static void fsmonitor_refresh_callback(struct index_state *istate, char *name) >> * Mark the untracked cache dirty even if it wasn't found in the index >> * as it could be a new untracked file. >> */ >> - trace_printf_key(&trace_fsmonitor, "fsmonitor_refresh_callback '%s'", name); > > Did you mean to remove this statement in this patch? Not a big issue, but > I wonder what the rationale for it is, and since I have an inquisitive > mind, I figured I'd just ask. I just moved it to the top of the function. That lets me see `name` before it is modified in one of the else arms (it was helpful to see whether the daemon sent a trailing slash or not). And I also wanted to see the computed value of `pos` (before the "-pos - 1" tricks). Jeff