git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] strbuf_write: omit system call when length is zero

From
Stefan Beller <sbeller@google.com>
Date
Feb 26, 2016, 17:09 UTC
Message-ID
<CAGZ79kZYqf3K5mR0_1eeQHO-n675BRfEQvC_-YCb+gOPTJ5xXA@mail.gmail.com>
In-Reply-To
<xmqqy4a8l04f.fsf@gitster.mtv.corp.google.com>
On Thu, Feb 25, 2016 at 5:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> On Fri, Feb 26, 2016 at 5:34 AM, Stefan Beller <sbeller@google.com> wrote:
>>> In case the length of the buffer is zero, we do not need to call the
>>> fwrite system call as a performance improvement.
>>
>> fwrite is a libc call, not system call. Are you sure it always calls
>> write() (assuming buffering is off)?
>
> I do not think so, but I suspect that the patch misstates its
> rationale (I said I get uncomfortable every time I see a function
> that takes size and nelem separately used by a caller that can
> potentially pass nleme=0, when I wondered it it is OK that no caller
> of this funtion checks its return value).
>

This is exactly what happened. I assumed fwrite would be a system call eventually.

Previous: Junio C Hamano
Message 5 of 5 in “strbuf_write: omit system call when length is zero”
  1. strbuf_write: omit system call when length is zeroStefan Beller, Feb 25, 2016
  2. Junio C HamanoFeb 25, 2016
  3. Duy NguyenFeb 26, 2016
  4. Junio C HamanoFeb 26, 2016
  5. Stefan BellerFeb 26, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.