On Fri, Apr 19, 2019 at 04:18:25PM +0700, Duy Nguyen wrote: > > I also wondered if we could just accept the cost of calloc() here and > > use FLEX_ALLOC to simplify things. That resulted in the patch below, but > > I didn't include it with the initial 3, because I think it's too > > subtle/gross for my tastes. > > It's probably ok. If I remember correctly, reading UNTR extension (on > a huge repo) took the longest time after Ben added support for reading > the index with multiple threads. So performance is a concern, but I > don't think calloc() would be the problem. malloc() itself without the > memory pool could probably slow down more when we have lots and lots > of directories. I think if we do the FLEX_ALLOC_COPY() thing I mentioned that it would probably _not_ use calloc() there, since we'd know we were copying in the content from elsewhere. So that concern would go away either way. :) (But I'm still skeptical that FLEX_ALLOC_COPY() is worth it unless we can find at least one other caller). -Peff