Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-03 Thread Jeff King
On Fri, May 03, 2013 at 07:59:09AM +0200, Johannes Sixt wrote: Am 5/2/2013 17:46, schrieb Jeff King: On Thu, May 02, 2013 at 09:05:01AM +0200, Johannes Sixt wrote: BTW, do you notice that the function is now modifying an object (the hash table) even though this is rather unexpected from a

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-03 Thread Jeff King
On Fri, May 03, 2013 at 02:02:44AM -0400, Jeff King wrote: Can we be sure that the function is never invoked in concurrently from different threads? I attempted to audit code paths, but quickly gave up because I know too little about this machinery. I didn't check explicitly, but in

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Johannes Sixt
Am 5/1/2013 22:34, schrieb Jeff King: struct object *lookup_object(const unsigned char *sha1) { - unsigned int i; + unsigned int i, first; struct object *obj; if (!obj_hash) return NULL; - i = hashtable_index(sha1); + first = i =

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Jeff King
On Thu, May 02, 2013 at 08:44:07AM +0200, Johannes Sixt wrote: Am 5/1/2013 22:34, schrieb Jeff King: struct object *lookup_object(const unsigned char *sha1) { - unsigned int i; + unsigned int i, first; struct object *obj; if (!obj_hash) return NULL;

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Johannes Sixt
Am 5/2/2013 8:46, schrieb Jeff King: On Thu, May 02, 2013 at 08:44:07AM +0200, Johannes Sixt wrote: Am 5/1/2013 22:34, schrieb Jeff King: struct object *lookup_object(const unsigned char *sha1) { - unsigned int i; + unsigned int i, first; struct object *obj; if (!obj_hash)

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Junio C Hamano
Jeff King p...@peff.net writes: I figured the lengthy description in the commit message would be sufficient, but I don't mind adding something like your suggestion to point readers of the code in the right direction when they see it. Yeah, I'll squash J6t's comment in and requeue. If

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Junio C Hamano
Johannes Sixt j.s...@viscovery.net writes: BTW, do you notice that the function is now modifying an object (the hash table) even though this is rather unexpected from a lookup function? At the philosophical level, lookup ought to be operating on a const table. But at the implementation level,

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Jeff King
On Thu, May 02, 2013 at 09:05:01AM +0200, Johannes Sixt wrote: I figured the lengthy description in the commit message would be sufficient, It's absolutely sufficient *if* one reads the commit message. In this case, though it goes more like this function should be trivial, and it is --

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-02 Thread Jeff King
On Thu, May 02, 2013 at 08:46:08AM -0700, Junio C Hamano wrote: Johannes Sixt j.s...@viscovery.net writes: BTW, do you notice that the function is now modifying an object (the hash table) even though this is rather unexpected from a lookup function? At the philosophical level, lookup

Re: [PATCH] lookup_object: prioritize recently found objects

2013-05-01 Thread Junio C Hamano
Jeff King p...@peff.net writes: We could instead bump X into the `i` slot, and then shift the whole contiguous chain down by one, resulting in: index | i-1 | i | i+1 | i+2 | --- entry ... | A | X | B | C | ...