Re: memrchr() implementation
- From
Jeff King <peff@peff.net>
- Date
- Jul 29, 2011, 04:40 UTC
- Message-ID
- <20110729044031.GA17481@sigill.intra.peff.net>
- In-Reply-To
- <CALUzUxqNGsThcWem4mj=M3EcFF_N5GpARB+x0qx+Q1Gs76Gzig@mail.gmail.com>
On Fri, Jul 29, 2011 at 12:33:01PM +0800, Tay Ray Chuan wrote:
> I'm writing a patch that requires the use of memrchr(). [1] As far as > I know, memrchr() is non-standard.
Yep.
Show 5 quoted lines
> So what's the best way to get git to use memrchr()? > > I was thinking of getting git to use glibc's implementation if glibc > is present, if not, use a naive implementation included in git's code > base [2].
Yeah, that's our usual strategy; see how strchrnul is implemented for an example.
Since you are doing this for speed and not ease-of-use, I assume you are benchmarking stock git versus glibc's optimized memrchr. I'd be curious to see a comparison to your naive implementation, too, just to double-check that your attempt at speeding up doesn't make things worse on non-glibc platforms.
-Peff