From: Linus Torvalds <torvalds@linux-foundation.org>
To: Nicolas Pitre <nico@cam.org>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
Junio C Hamano <junkio@cox.net>,
git@vger.kernel.org
Subject: Re: [PATCH] Limit the size of the new delta_base_cache
Date: Mon, 19 Mar 2007 10:17:50 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0703191008400.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0703191004560.6730@woody.linux-foundation.org>
On Mon, 19 Mar 2007, Linus Torvalds wrote:
>
> Which totally throws your argument out of the window. It's simply not true
> any more: the cache will *not* be more effective the larger the objects
> are, because you are ignoring the fact that adding a large object will
> *remove* many small ones.
And btw, if you are adding a delta-base object that is bigger than 10%-20%
(those particular numbers taken out of where the sun don't shine, but they
are reasonable) of your cache size, you are pretty much *guaranteed* to be
removing many small ones.
Why?
The whole *point* of the delta-base cache is that it wants to avoid the
O(n**2) costs of the long cache-chains. So a delta-base object on its own
is almost not interesting for the cache: the cache comes into its own only
if you have a *chain* of delta-base objects.
So rather than thinking about "one big object", you need to think about "a
chain of objects", and realize that if one of them is big, then the others
will be too (otherwise they'd not have generated a delta-chain in the
first place).
So at an object size of 10-20% of the total allowed cache size, and a
total cache _index_ of 256 entries, if you start adding big objects, you
can pretty much be guaranteed that either
(a) the delta-base cache won't be effective for the big object anyway,
since there's just one or two of them (and the cache size limit isn't
triggered)
OR
(b) you start probing the cache size limit, and you'll be throwing out
many small object.
Finally, since the delta-chain cache is likely not as useful for blobs
anyway (you don't tend to use tons of big related blobs anyway, and if you
do, the real costs are likely the xdl diff generation between them rather
than the object creation itself!), you're also likely optimizing the wrong
case, since big delta-base objects are almost certainly goign to be blobs.
And no, I don't have any "hard numbers" to back this up, but if you want
another argument, realize that delta chains are limited to a depth of ten,
and if a *single* chain can overflow the delta-chain cache, then the cache
ends up being 100% *in*effective. And do the math: if the object size is
10-20% of the total allowed cache size, how many objects in the chain are
you going to fit in the cache?
So there are multiple different reasons to think that big objects are
actually *bad* for caching when you have a total size limit, not good.
Linus
next prev parent reply other threads:[~2007-03-19 17:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 5:14 [PATCH] Limit the size of the new delta_base_cache Shawn O. Pearce
2007-03-19 16:10 ` Linus Torvalds
2007-03-19 16:41 ` Nicolas Pitre
2007-03-19 16:54 ` Nicolas Pitre
2007-03-19 17:18 ` Linus Torvalds
2007-03-19 17:07 ` Linus Torvalds
2007-03-19 17:17 ` Linus Torvalds [this message]
2007-03-19 18:08 ` Nicolas Pitre
-- strict thread matches above, loose matches on Subject: below --
2007-03-19 4:48 Shawn O. Pearce
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=Pine.LNX.4.64.0703191008400.6730@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=nico@cam.org \
--cc=spearce@spearce.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;
as well as URLs for NNTP newsgroup(s).