From: Piotr Krukowiecki Date: Fri, 10 Feb 2012 16:18:55 GMT Subject: Re: git status: small difference between stating whole repository and small subdirectory Message-ID: In-Reply-To: On Fri, Feb 10, 2012 at 10:42 AM, Piotr Krukowiecki wrote: > Hi, > > I compared stating whole tree vs one small subdirectory, and I > expected that for the subdirectory status will be very very fast. > After all, it has only few files to stat. But it's not fast. Why? > > > With cold cache (echo 3 | sudo tee /proc/sys/vm/drop_caches): > > $ time git status    > /dev/null > real    0m41.670s > user    0m0.980s > sys     0m2.908s > > $ time git status -- src/.../somedir   > /dev/null > real    0m17.380s > user    0m0.748s > sys     0m0.328s > > > With warm cache: > > $ time git status    > /dev/null > real    0m0.792s > user    0m0.404s > sys     0m0.384s > > $ time git status -- src/.../somedir   > /dev/null > real    0m0.335s > user    0m0.288s > sys     0m0.048s > > > Repository/dir stats: > > $ find * -type f | wc -l > 127189 > $ du -shc * | grep total > 2.2G    total > > $ find src/.../somedir -type f | wc -l > 55 > $ du -shc src/.../somedir | grep total > 224K    total > > > $ git --version > git version 1.7.9.rc0.10.gbeecc I can't reproduce this behavior at the moment. 'status' on the directory takes about 1.5s instead of 17s. status on whole repository takes 27s. This is my work repository, so it was changed today. I'll get back to you when I can reproduce the problem again... -- Piotr Krukowiecki