Thread (10 messages) flat view 10 messages, 4 authors, 2016-08-13

Re: [PATCH] Teach "git add" and friends to be paranoid

From: Nicolas Pitre <nico@fluxnic.net>
Date: 2016-06-15 22:48:19

On Sun, 21 Feb 2010, Junio C Hamano wrote:
Dmitry Potapov [off-list ref] writes:
quoted
If you look at speed-up numbers, you can think that the numbers are
unstable, but in fact, the best time in 5 runs does not differ more
than 0.01s between those trials. But because difference for >=128Kb
is 0.05s or less, the accuracy of the above numbers is less than 25%.
Then wouldn't it make the following statement...
quoted
But overall the outcome is clear -- read() is always a winner.
"... a winner, below 128kB; above that the difference is within noise and
measurement error"?
read() is not always a winner.  A read() call will always have the data 
duplicated in memory.  Especially with large files, it is more efficient 
on the system as a whole to mmap() a 50 MB file rather than allocating 
an extra 50 MB of anonymous memory that cannot be paged out (except to 
the swap file which would be yet another data duplication).  With mmap() 
when there is memory pressure the read-only mapped memory is simply 
dropped with no extra IO.

So when read() is not _significantly_ faster than mmap() then it should 
not be used.


Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help