All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Karsten Blees <karsten.blees@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: struct hashmap_entry packing
Date: Tue, 5 Aug 2014 14:51:37 -0400	[thread overview]
Message-ID: <20140805185137.GB10369@peff.net> (raw)
In-Reply-To: <53DFDCE2.9060406@gmail.com>

On Mon, Aug 04, 2014 at 09:20:02PM +0200, Karsten Blees wrote:

> > I don't see any reason to avoid the packed attribute, if it helps us. As
> > you noted, anything using __attribute__ probably supports it, and if
> > not, we can conditionally #define PACKED_STRUCT or something, like we do
> > for NORETURN. Since it's purely an optimization, if another compiler
> > doesn't use it, no big deal.
> > 
> > That being said, I don't know if those padding bytes are actually
> > causing a measurable slowdown. It may not even be worth the trouble.
> > 
> 
> Its not about performance (or correctness, in case of platforms that don't
> support unaligned read), just about saving memory (e.g. mapping int to int
> requires 24 bytes per entry, vs. 16 with packed structs).

The biggest things we might map are probably one entry per-object. So in
a repository like linux.git, we're talking about 32MB in the worst case.
That's not nothing, but it's also not the end of the world. I'd be more
concerned with how that trashes the cache (and consequently causes
slowdown) than somebody running out of memory.

So my general opinion is that if it's easy to get the space back, great.
But if it creates a maintenance hassle, it's not worth the effort.

That said, I really don't think it would be much maintenance hassle to
mark the hashmap_entry as packed, and compilers can either handle it or
not.

-Peff

      reply	other threads:[~2014-08-05 18:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 17:17 struct hashmap_entry packing Jeff King
2014-07-29 20:40 ` Karsten Blees
2014-08-01 22:37   ` Jeff King
2014-08-01 23:10     ` [PATCH] pack-bitmap: do not use gcc packed attribute Jeff King
2014-08-01 23:12       ` Jeff King
2014-08-04 19:19       ` Karsten Blees
2014-08-05 18:38         ` Vicent Martí
2014-08-05 18:47         ` Jeff King
2014-08-06 18:58           ` Karsten Blees
2014-08-06 19:32             ` Junio C Hamano
2014-08-04 19:20     ` struct hashmap_entry packing Karsten Blees
2014-08-05 18:51       ` Jeff King [this message]

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=20140805185137.GB10369@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=karsten.blees@gmail.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.