git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Barr <davidbarr@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [RFC/PATCH 2/3] small-alloc: add allocator for small objects
Date: Fri, 24 Jun 2011 10:02:16 -0700	[thread overview]
Message-ID: <BANLkTi=1NhVHMScynVFWxQo2H_mAGq0t1Q@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=34cQvU9oE0gPe=5PFDYfhxoYF+A@mail.gmail.com>

Junio wrote:
> Instead of having two independently depleted byte-buffer (space[] and
> len[]), I wonder if it would be more space efficient (without being less
> processing efficient) to use a single buffer space.  Your pool_ptr() would
> start at the beginning of pool->space[n], decode a varint and take it as a
> length, if that is not the object you are looking for, skip that many
> bytes (i.e. payload immediately follows the length) to the next object,
> and so on.

David Barr wrote:
> I have already investigated this arrangement, it has very poor
> locality of access.
> For objects <32 bytes long, its not too bad since typically 2 bytes of a 64 byte
> cache line would be read consecutively. For larger objects this is pathological
> cache behavior. On the other hand, the current design means that the entire
> sequence of lengths will fit on a single >=16 byte cache line.

Another approach is to keep the buffers separate but interleave
pointers and lengths.
I'll give this a go and see if it's an overall improvement.

--
David Barr

  reply	other threads:[~2011-06-24 17:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22  7:33 [RFC/PATCH 0/3] David Barr
2011-06-22  7:33 ` [RFC/PATCH 1/3] protobuf: minimal implementation for compact in-memory structures David Barr
2011-06-22 19:42   ` Junio C Hamano
2011-06-24 14:39     ` David Barr
2011-06-24 16:04     ` David Barr
2011-06-24 16:48       ` Junio C Hamano
2011-06-23 17:22   ` Junio C Hamano
2011-06-22  7:33 ` [RFC/PATCH 2/3] small-alloc: add allocator for small objects David Barr
2011-06-22 20:49   ` Junio C Hamano
2011-06-24 14:38     ` David Barr
2011-06-24 17:02       ` David Barr [this message]
2011-06-23 17:17   ` Junio C Hamano

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='BANLkTi=1NhVHMScynVFWxQo2H_mAGq0t1Q@mail.gmail.com' \
    --to=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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).