Optimal stored property packing
I'm curious why Swift doesn't use optimal (from a size perspective) ordering of stored properties, for non-frozen structs (and similar)? As far as I can tell there's nothing in the ABI that prevents...
View ArticleOptimal stored property packing
wadetregaskis: I'm curious why Swift doesn't use optimal (from a size perspective) ordering of stored properties, for non-frozen structs (and similar)? Haven't gotten around to it yet. Read full topic
View ArticleOptimal stored property packing
Joe_Groff: Haven't gotten around to it yet. Hah, fair enough, I guess. But just to confirm, then, this is something which Swift can be made to do in future? Read full topic
View ArticleOptimal stored property packing
It should be possible for any type that hasn't made itself @frozen in an ABI-stable context, yeah. It's one reason we try to discourage people from relying on in-memory layout to follow declaration...
View ArticleOptimal stored property packing
If you (or someone else reading) is interested in exploring this, another form of layout optimization we'd like to do is to use spare bits to pack Bool and small enum fields, like we do with...
View ArticleOptimal stored property packing
I remain unconvinced about doing this one by default because it makes assigning a new value to the base property much more expensive: read old value, extract bits, apply to new value, store new value....
View ArticleOptimal stored property packing
jrose: I remain unconvinced about doing this one by default because it makes assigning a new value to the base property much more expensive: read old value, extract bits, apply to new value, store new...
View ArticleOptimal stored property packing
jrose: it makes assigning a new value to the base property much more expensive: read old value, extract bits, apply to new value, store new value. Reading likewise gets an extra masking step. Even so...
View Article