On Fri, Apr 17, 2015 at 09:21:31AM -0700, Junio C Hamano wrote: > Jeff King <p...@peff.net> writes: > > > If there _is_ a performance implication to worry about here, I think it > > would be that we are doing an extra malloc/free. > > Thanks for reminding me; yes, that also worried me.
As an aside, I worried about the extra allocation for reading the header in the first place. But it looks like we only do this on the --literally code path (and otherwise use the normal unpack_sha1_header). Still, I wonder if we could make this work automagically. That is, speculatively unpack the first N bytes, assuming we hit the end-of-header. If not, then go to a strbuf as the slow path. Then it would be fine to cover all cases; the normal ones would be fast, and only ridiculous things would incur the extra allocation. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html