git status: small difference between stating whole repository and small subdirectory
- From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
- Date
- Feb 10, 2012, 09:42 UTC
- Message-ID
- <CAA01Csr8FbvQ8uFvxX8_6i-hysin6JuaifVVC-yoLyoT0N5F4Q@mail.gmail.com>
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
-- Piotr Krukowiecki