[Pitch] 128 bit Integer Types

No, I don't think so! The alignment of Duration was very intentionally chosen to be the same as Int64 everywhere (usually 8, except i386, where presumably it's 4).

We did consider explicitly setting its alignment to 16, and we deliberately chose not to do that, precisely because we worried about unnecessarily wasting memory on padding. Optional Durations definitely do frequently pop up as stored properties, sometimes perhaps even in bulk.

(I think I was the one finalizing the Duration ABI -- hence my confident assertion about the choice being deliberate & independent of the availability of a proper Int128 implementation. But my hand was lovingly guided by expert opinion, Patrick Swayze style -- hence the royal "we".)

struct Duration is a frozen type, so its layout is what it is. We do need new APIs on it, though!

5 Likes