From: "Andrew Lutomirski" <luto@myrealbox.com>
To: "Andi Kleen" <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, kernel1@cyberdogtech.com
Subject: Re: A little coding style nugget of joy
Date: Wed, 19 Sep 2007 17:39:46 -0400 [thread overview]
Message-ID: <cb0375e10709191439v7e0aec69m1dd2db7ca5b12b8a@mail.gmail.com> (raw)
In-Reply-To: <20070919213010.GG18707@one.firstfloor.org>
On 9/19/07, Andi Kleen <andi@firstfloor.org> 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).
>
> You didn't calculate the probability of actually saving a full block
> or not (that's the only thing that matters). I assumed it's relatively
> small and can be ignored in practice since the amount of end white
> space is negligible compared to total file size.
Sure I did. It's roughly 1/B per byte removed ( = 1/4096 ).
--Andy
next prev parent reply other threads:[~2007-09-19 21:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 16:34 Matt LaPlante
2007-09-19 17:13 ` Andi Kleen
2007-09-19 21:22 ` Andy Lutomirski
2007-09-19 21:30 ` Andi Kleen
2007-09-19 21:39 ` Andrew Lutomirski [this message]
2007-09-20 9:20 ` Pádraig Brady
2007-09-20 10:11 ` Robert P. J. Day
2007-09-20 14:04 ` Scott Preece
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb0375e10709191439v7e0aec69m1dd2db7ca5b12b8a@mail.gmail.com \
--to=luto@myrealbox.com \
--cc=andi@firstfloor.org \
--cc=kernel1@cyberdogtech.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®