From: Junio C Hamano Date: Wed, 10 Aug 2016 21:28:26 GMT Subject: Re: [PATCH 8/8] diff: improve positioning of add/delete blocks in diffs Message-ID: In-Reply-To: <5fe0edbc-3659-058f-3328-639d1343fa05@alum.mit.edu> Michael Haggerty writes: >> After >> all, somebody in this file is already scanning each and every line >> to see where it ends to split the input into records, so perhaps a >> "right" (if the "theoretical correctness" of the return value from >> this function mattered, which you wave-away below) optimization >> could be to precompute it while the lines are broken into records >> and store it in the "rec" structure? > > That would certainly be possible, and would help in cases where there > are a lot of lines with lots of leading whitespace. You could get nearly > the same benefit by recording a single bit in struct rec, indicating > whether the line is blank or not. > > But it wouldn't help the worst case described above, where each call to > `git_indent()` is already very cheap. And I didn't think it was worth > allocating the extra memory to optimize this heuristic True. > I don't know. It seems like a pretty contrived justification for what is > basically, "your input is too weird for us. We're not going to break our > necks trying to give you the best possible slider positioning." True again.