Liste des Groupes | Revenir à c arch |
Agreed, highest performance comes when there are as few misaligned>Aligned data is always best, Misaligned data comes at very low cost.Thinking about this for a bit... for a clean-sheet architecture
SW overhead = 0
like My66000, could there actually be an advantage to do
struct layout like the VAX did, with everything aligned on byte
boundaries?
I highly doubt it. Making unaligned accesses work efficiently is great,
but that's no reason to abuse them:
- Going back to Mitch's description, in case B.1 the misalignment isShould be only memory footprint.
truly "free", but for B.2, B.3, and B.4 the misalignment does come at
a cost, not necessarily visible in terms of cycles but at least in
terms of cache bandwidth, which can have an impact on overall speed
and energy use.
Of course, properly aligning your data will also come with costs,
but "packed structs" don't come totally free.There is NO REASON to make them slower than doable.
- AFAIK most efforts to support concurrency take it for granted thatAnd you don't want multiple locks in the same cache line.
atomic accesses are supported only when properly aligned.
I expect it's at least as easy (and more portable) to reorder fields by
order of (expected) size to avoid excessive padding in aligned data,
than it is to add manual padding/alignment to avoid the cost of
misalignment in "packed structs".
>
>
Stefan
Les messages affichés proviennent d'usenet.