From: Nicolas Pitre <nico@cam.org>
To: Linus Torvalds <torvalds@linux-foundation.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 12:41:10 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.0.83.0703191218190.18328@xanadu.home> (raw)
In-Reply-To: <Pine.LNX.4.64.0703190906320.6730@woody.linux-foundation.org>
On Mon, 19 Mar 2007, Linus Torvalds wrote:
>
>
> On Mon, 19 Mar 2007, Shawn O. Pearce wrote:
> >
> > Round two, based on comments on IRC from Junio:
>
> One more change: please don't even *add* objects to the cache that are
> bigger than 10-20% of the cache limit!
>
> If you start adding big objects, and you have some cache limit, that will
> make the cache seriously less useful by causing eviction of potentially
> much more interesting objects, and also obviously causing the cache code
> itself to spend much more time picking objects (since it's enough to have
> just a few big objects to make the cache eviction decide it needs to
> evict).
>
> Limiting by size is also effective since anything that is more than a
> megabyte is likely to be a blob anyway, and thus much less useful for
> caching in the first place. So there are just tons of reasons to say
> "don't even add it in the first place" if you decide to go with any limit
> at all.
On the other hand......
Either you parse blobs or you don't. If you only do logs with path
limiting then you won't add blobs to the cache anyway.
If you do end up adding blobs to the cache that means you have blob
deltas to resolve, and even that operation should benefit from the cache
regardless of the object size.
In fact, the bigger is the object, the more effective will be the cache.
Because you certainly don't want to have a complete breakdown in
performance just because a blob just crossed the 20% treshold.
And because we usually walk objects from newest to oldest, and because
deltas are usually oriented in the same direction, we only need to tweak
the current eviction loop a bit so on average the oldest objects are
evicted first so next time around the current base will still be there
for the next delta depth. Given the nature of the hash containing the
object's offset that means starting the loop at the next entry index
instead of zero which should do the trick pretty well.
Of course if you end up in a condition where you have to prune the cache
continuously, you'll spend more cycles picking up the object to evict,
but it is likely to be so much less work than reintering that O(n!)
behavior with deflate we had without the cache, and even worse since we
mean big objects in this case.
So I wouldn't add any rule of that sort unless it is actually proven to
be bad.
Nicolas
next prev parent reply other threads:[~2007-03-19 16:41 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 [this message]
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
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=alpine.LFD.0.83.0703191218190.18328@xanadu.home \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=spearce@spearce.org \
--cc=torvalds@linux-foundation.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).