Re: [PATCH] oidmap: map with OID as key

2017-09-29 Thread Jeff King
On Fri, Sep 29, 2017 at 11:43:57PM +0200, Johannes Schindelin wrote: > On Thu, 28 Sep 2017, Jeff King wrote: > > > If you're planning on using an oidset to mark every object in a > > 100-million-object monorepo, we'd probably care more. But I'd venture to > > say that any scheme which involves

Re: [PATCH] oidmap: map with OID as key

2017-09-29 Thread Johannes Schindelin
Hi Peff, On Thu, 28 Sep 2017, Jeff King wrote: > If you're planning on using an oidset to mark every object in a > 100-million-object monorepo, we'd probably care more. But I'd venture to > say that any scheme which involves generating that hash table on the fly > is doing it wrong. At at that

Re: [PATCH] oidmap: map with OID as key

2017-09-29 Thread Jeff King
On Fri, Sep 29, 2017 at 12:04:56PM -0700, Jonathan Tan wrote: > > So depending how you count it, we're wasting between 28% (sha1 and no > > extra hash) and 16% (sha256 plus reusing hashmap). That's not great, but > > it's probably not breaking the bank. > > Hmm...how did you get the 16% figure?

Re: [PATCH] oidmap: map with OID as key

2017-09-29 Thread Jonathan Tan
On Thu, 28 Sep 2017 16:05:57 -0400 Jeff King wrote: > When I saw that you were implementing "oidset" in terms of "oidmap", I > was all ready to be crabby about this extra memory. But then I saw that > the implementation tries hard not to waste any memory. :) > > All of which is

Re: [PATCH] oidmap: map with OID as key

2017-09-28 Thread Jeff King
On Thu, Sep 28, 2017 at 10:46:16AM -0700, Jonathan Tan wrote: > > To me it seems like a much simpler API for a map would be to just allow > > callers to store a 'void *' as the value. > > I agree that the API would be simpler. > > My main motivation with this design is indeed to save memory,

Re: [PATCH] oidmap: map with OID as key

2017-09-28 Thread Jonathan Tan
On Wed, 27 Sep 2017 17:41:37 -0700 Brandon Williams wrote: > On 09/27, Jonathan Tan wrote: > > This is similar to using the hashmap in hashmap.c, but with an > > easier-to-use API. In particular, custom entry comparisons no longer > > need to be written, and lookups can be

Re: [PATCH] oidmap: map with OID as key

2017-09-28 Thread Jonathan Tan
On Thu, 28 Sep 2017 12:13:00 +0900 Junio C Hamano wrote: > Jonathan Tan writes: > > > This is similar to using the hashmap in hashmap.c, but with an > > easier-to-use API. In particular, custom entry comparisons no longer > > need to be written, and

Re: [PATCH] oidmap: map with OID as key

2017-09-27 Thread Junio C Hamano
Jonathan Tan writes: > This is similar to using the hashmap in hashmap.c, but with an > easier-to-use API. In particular, custom entry comparisons no longer > need to be written, and lookups can be done without constructing a > temporary entry structure. A naïve

Re: [PATCH] oidmap: map with OID as key

2017-09-27 Thread Brandon Williams
On 09/27, Jonathan Tan wrote: > This is similar to using the hashmap in hashmap.c, but with an > easier-to-use API. In particular, custom entry comparisons no longer > need to be written, and lookups can be done without constructing a > temporary entry structure. > > oidset has been updated to

[PATCH] oidmap: map with OID as key

2017-09-27 Thread Jonathan Tan
This is similar to using the hashmap in hashmap.c, but with an easier-to-use API. In particular, custom entry comparisons no longer need to be written, and lookups can be done without constructing a temporary entry structure. oidset has been updated to use oidmap. Signed-off-by: Jonathan Tan