Re: [PATCH] Teach "git add" and friends to be paranoid
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 21, 2010, 19:32 UTC
- Message-ID
- <7vhbpas7ut.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20100221072142.GA5829@dpotapov.dyndns.org>
Dmitry Potapov <dpotapov@gmail.com> writes:
Show 12 quoted lines
> file size = 1Kb; Hashing 100000 files > Before: > 0.63user 0.86system 0:01.49elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k > 0inputs+0outputs (0major+100428minor)pagefaults 0swaps > After: > 0.54user 0.53system 0:01.07elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k > 0inputs+0outputs (0major+421minor)pagefaults 0swaps > > As you can see, in all tests the read() version performed better than > mmap() though the difference decreases with increase of the file size. > While for 1Kb files, the speed up is 39% (based on the elapsed time), > it is mere 1% for 1Mb file size.
Sounds good. Summarizing your numbers,
1Kb 39.25%
2Kb 27.27%
4Kb 17.06%
8Kb 11.21%
16Kb 7.00%
32Kb 4.81%
64Kb 3.31%
128Kb 2.29%
256Kb 3.51%
512Kb 2.92%
1024Kb 1.14%32*1024 sounds like a better cut-off to me. After that, doubling the size does not get comparable gain, and numbers get unstable (notice the glitch around 256kB).