[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Dict parsing question
From:       Lawrence D'Oliveiro <ldo () geek-central ! gen ! nz>
Date:       2023-12-15 21:03:26
Message-ID: 20231216100326.7cc03d96 () theon ! geek-central ! gen ! nz
[Download RAW message or body]

On Fri, 15 Dec 2023 15:55:38 +0000, Simon McVittie wrote:

> It's misleading to say that the beginning of a dict is 8-byte-aligned
> ...

You are right about that, because the spec did say "dict entries", not
"dicts" (as I thought).

> The array is *4*-byte aligned, the same as any other array (because it
> starts with a 4-byte length). After the length, the dict entries
> inside it are 8-byte aligned, the same as structs.

It seems to me that having aligned fields within wire protocols is just
a recipe for adding to the confusion. Is there really a measurable
performance improvement from keeping things aligned? Is the wasted
space worth it? And then we have the issue that the optimum alignment
for some things on 64-bit architectures is different from that for
32-bit ones. So layout decisions made back in the 32-bit era start to
look a bit anachronistic now that 64-bit machines are dominant.

"Premature optimization is the root of all evil."
  -- variously attributed to Tony Hoare or Donald Knuth
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic