From: Andi Kleen <andi@firstfloor.org>
To: Andy Lutomirski <luto@myrealbox.com>
Cc: linux-kernel@vger.kernel.org, andi@firstfloor.org,
kernel1@cyberdogtech.com
Subject: Re: A little coding style nugget of joy
Date: Wed, 19 Sep 2007 23:30:10 +0200 [thread overview]
Message-ID: <20070919213010.GG18707@one.firstfloor.org> (raw)
In-Reply-To: <46F19326.1040503@myrealbox.com>
> 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.
-Andi
next prev parent reply other threads:[~2007-09-19 21:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 16:34 A little coding style nugget of joy Matt LaPlante
2007-09-19 17:13 ` Andi Kleen
2007-09-19 21:22 ` Andy Lutomirski
2007-09-19 21:30 ` Andi Kleen [this message]
2007-09-19 21:39 ` Andrew Lutomirski
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=20070919213010.GG18707@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=kernel1@cyberdogtech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@myrealbox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.