Re: [PATCH v5 01/12] pkt-line: eliminate the need for static buffer in packet_write_gently()
- From
Jeff King <peff@peff.net>
- Date
- Mar 11, 2021, 20:53 UTC
- Message-ID
- <YEqDZP/Ea+qf0Qrp@coredump.intra.peff.net>
- In-Reply-To
- <xmqq4khhctya.fsf@gitster.g>
On Thu, Mar 11, 2021 at 12:32:29PM -0800, Junio C Hamano wrote:
Show 26 quoted lines
> Jeff King <peff@peff.net> writes: > > > On Tue, Mar 09, 2021 at 03:48:40PM -0800, Junio C Hamano wrote: > > > >> "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes: > >> > >> > + /* > >> > + * Write the header and the buffer in 2 parts so that we do not need > >> > + * to allocate a buffer or rely on a static buffer. This avoids perf > >> > + * and multi-threading issues. > >> > + */ > >> > >> I understand "multi-threading issues" (i.e. let's not have too much > >> stuff on the stack), but what issue around "perf" are we worried > >> about? > >> ... > > Yeah, this came from my suggestion. My gut feeling is that it isn't > > likely to matter, but I'd much rather solve any performance problem we > > find using writev(), which would be pretty easy to emulate with a > > wrapper for systems that lack it. > > I too had writev() in mind when I said "can fix it locally", so we > are on the same page, which is good. > > So "this avoid multi-threading issues" without mentioning "perf and" > would be more appropriate?
IMHO yes. I think "avoid perf issues" is probably answering the "why not just heap-allocate the buffer" question. But that makes sense in the commit message, not in a comment.
-Peff