Re: [PATCH] Preallocate hash tables when the number of inserts are known in advance

2013-03-17 Thread Jeff King
On Sun, Mar 17, 2013 at 10:28:06AM +0700, Nguyen Thai Ngoc Duy wrote: > This avoids unnecessary re-allocations and reinsertions. On webkit.git > (i.e. about 182k inserts to the name hash table), this reduces about > 100ms out of 3s user time. Good idea. I had a similar thought when analyzing the

Re: [PATCH] Preallocate hash tables when the number of inserts are known in advance

2013-03-16 Thread Junio C Hamano
Duy Nguyen writes: > On Sun, Mar 17, 2013 at 12:34 PM, Junio C Hamano wrote: >> Nguyễn Thái Ngọc Duy writes: >> >>> This avoids unnecessary re-allocations and reinsertions. On webkit.git >>> (i.e. about 182k inserts to the name hash table), this reduces about >>> 100ms out of 3s user time. >>>

Re: [PATCH] Preallocate hash tables when the number of inserts are known in advance

2013-03-16 Thread Duy Nguyen
On Sun, Mar 17, 2013 at 12:34 PM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> This avoids unnecessary re-allocations and reinsertions. On webkit.git >> (i.e. about 182k inserts to the name hash table), this reduces about >> 100ms out of 3s user time. >> >> Signed-off-by: Nguyễn Thái

Re: [PATCH] Preallocate hash tables when the number of inserts are known in advance

2013-03-16 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > This avoids unnecessary re-allocations and reinsertions. On webkit.git > (i.e. about 182k inserts to the name hash table), this reduces about > 100ms out of 3s user time. > > Signed-off-by: Nguyễn Thái Ngọc Duy I think this is a very good idea, but I would prefer

[PATCH] Preallocate hash tables when the number of inserts are known in advance

2013-03-16 Thread Nguyễn Thái Ngọc Duy
This avoids unnecessary re-allocations and reinsertions. On webkit.git (i.e. about 182k inserts to the name hash table), this reduces about 100ms out of 3s user time. Signed-off-by: Nguyễn Thái Ngọc Duy --- nd/read-directory-recursive-optim reduces the number of input (from 182k to 11k on webki