Re: [PATCH 7/9] strbuf_getwholeline: use getdelim if it is available
- From
Jeff King <peff@peff.net>
- Date
- Apr 22, 2015, 18:06 UTC
- Message-ID
- <20150422180628.GA3535@peff.net>
- In-Reply-To
- <alpine.DEB.1.00.1504222000040.28561@s15462909.onlinehome-server.info>
On Wed, Apr 22, 2015 at 08:00:55PM +0200, Johannes Schindelin wrote:
Show 11 quoted lines
> On 2015-04-17 12:16, Eric Sunshine wrote: > > On Thu, Apr 16, 2015 at 5:01 AM, Jeff King <peff@peff.net> wrote: > >> We spend a lot of time in strbuf_getwholeline in a tight > >> loop reading characters from a stdio handle into a buffer. > >> The libc getdelim() function can do this for us with less > >> overhead. > > Just for the record: Git for Windows cannot lean on `getdelim()`, as > it is not available on Windows. Do not let that stop you; if it turns > out to impact performance, we will just have to come up with our own > implementation of that function.
Hopefully the earlier patch in the series to avoid locking will help on Windows. After the end of the series, it isn't used anymore on Linux, but I kept it in exactly for those less-fortunate systems.
If you can find a Windows equivalent that does the same thing as getdelim, it should be pretty easy to drop it into an alternate strbuf_getwholeline implementation (or just provide a compat "getdelim" if it is close enough to have the same interface).
-Peff