git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH 2/3] small-alloc: add allocator for small objects

From
David Barr <davidbarr@google.com>
Date
Jun 24, 2011, 17:02 UTC
Message-ID
<BANLkTi=1NhVHMScynVFWxQo2H_mAGq0t1Q@mail.gmail.com>
In-Reply-To
<BANLkTi=34cQvU9oE0gPe=5PFDYfhxoYF+A@mail.gmail.com>
Junio wrote:
Show 7 quoted lines
> 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:
Show 6 quoted lines
> 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

Previous: David BarrNext: Junio C Hamano
Message 11 of 12 in “[RFC/PATCH 0/3]”
  1. 0/3 David Barr, Jun 22, 2011
  2. 1/3 protobuf: minimal implementation for compact in-memory structuresDavid Barr, Jun 22, 2011
  3. Junio C HamanoJun 22, 2011
  4. David BarrJun 24, 2011
  5. David BarrJun 24, 2011
  6. Junio C HamanoJun 24, 2011
  7. Junio C HamanoJun 23, 2011
  8. 2/3 small-alloc: add allocator for small objectsDavid Barr, Jun 22, 2011
  9. Junio C HamanoJun 22, 2011
  10. David BarrJun 24, 2011
  11. David BarrJun 24, 2011
  12. Junio C HamanoJun 23, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.