Re: [PATCH] fast-export: avoid NULL pointer arithmetic
- From
Jeff King <peff@peff.net>
- Date
- May 11, 2018, 17:42 UTC
- Message-ID
- <20180511174237.GA19670@sigill.intra.peff.net>
- In-Reply-To
- <20180511133419.GA2170@duynguyen.home>
On Fri, May 11, 2018 at 03:34:19PM +0200, Duy Nguyen wrote:
Show 8 quoted lines
> On Fri, May 11, 2018 at 03:11:46PM +0200, Duy Nguyen wrote: > > Back to fast-export, can we just allocate a new int on heap and point > > it there? Allocating small pieces becomes quite cheap and fast with > > mem-pool.h and we can avoid this storing integer in pointer business. > > Something like this seems to work, but we use 4-ish more bytes per > object, or 100MB overhead on a repo with 25M objects. I think it's a > reasonable trade off.
I'm not sure I agree. 4 bytes per object certainly isn't the end of the world, but what was the problem we were solving in the first place? Just that we weren't comfortable with the round-trip from uintptr_t to void and back? Is this actually a problem on real platforms? If not, it seems silly to incur a run-time cost.
-Peff