Re: A little coding style nugget of joy

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <andi@...>, <kernel1@...>
Date: Wednesday, September 19, 2007 - 5:22 pm

Andi Kleen wrote:

This is a terrible assumption in general (i.e. if filesize % blocksize 
is close to uniformly distributed).  If you remove one byte and the data 
is stored with blocksize B, then you either save zero bytes with 
probability 1-1/B or you save B bytes with probability 1/B.  The 
expected number of bytes saved is B*1/B=1.  Since expectation is linear, 
if you remove x bytes, the expected number of bytes saved is x (even if 
there is more than one byte removed per file).

In my tree, about half of the files have size >= 4k, so the assumption 
is probably not _that_ far off the mark.

Alternatively, there are an average of about 16 bytes removed per file, 
and there are 11 which are <= 16 bytes short of a 4k boundary, so it's 
not at all unreasonable that we'd save 40-50k.


That's true.

--Andy
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
A little coding style nugget of joy, Matt LaPlante, (Wed Sep 19, 12:34 pm)
Re: A little coding style nugget of joy, Pádraig Brady, (Thu Sep 20, 5:20 am)
Re: A little coding style nugget of joy, Robert P. J. Day, (Thu Sep 20, 6:11 am)
Re: A little coding style nugget of joy, Scott Preece, (Thu Sep 20, 10:04 am)
Re: A little coding style nugget of joy, Andi Kleen, (Wed Sep 19, 1:13 pm)
Re: A little coding style nugget of joy, Andy Lutomirski, (Wed Sep 19, 5:22 pm)
Re: A little coding style nugget of joy, Andi Kleen, (Wed Sep 19, 5:30 pm)
Re: A little coding style nugget of joy, Andrew Lutomirski, (Wed Sep 19, 5:39 pm)