Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > The reason I did not do that was to avoid a full subroutine call, as I > expected this code path to be very expensive. This is only done for the "word diff" mode, and my gut feeling is that it is not such a big issue. But you can always inline it if it is performance critical. The current structure shows how this code evolved. fn_out_consume() used to be "this is called every time a line worth of diff becomes ready from the lower-level diff routine, and here is what we do to output line oriented diff using that line." When we introduced the "word diff" mode, we could have done three things. * change fn_out_consume() to "this is called every time a line worth of diff becomes ready from the lower-level diff routine. This function knows two sets of helpers (one for line-oriented diff, another for word diff), and each set has various functions to be called at certain places (e.g. hunk header, context, ...). The function's role is to inspect the incoming line, and dispatch appropriate helpers to produce either line- or word- oriented diff output." * introduce fn_out_consume_word_diff() that is "this is called every time a line worth of diff becomes ready from the lower-level diff routine, and here is what we do to prepare word oriented diff using that line." without touching fn_out_consume() at all. * Do neither of the above, and keep fn_out_consume() to "this is called every time a line worth of diff becomes ready from the lower-level diff routine, and here is what we do to output line oriented diff using that line." but sprinkle a handful of 'are we in word-diff mode? if so do this totally different thing' at random places. My clean-up "something like this" patch was to at least abstract the details of "this totally different thing" out from the main codepath, in order to improve readability. We can of course refactor this by introducing fn_out_consume_word_diff(), i.e. the second route above. Then we do not have to check "are we in word diff mode" for every line of diff and that would give you even better performance. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html