[swift-users] Memory used by enums
Jonathan Hull
jhull at gbis.com
Mon Apr 4 18:57:29 CDT 2016
I had a quick question on the memory used by enums with associated values in the current implementation. If I have an enum like the following:
enum MyEnum {
case mostCommonlyUsed
case somewhatCommon (Int,Int)
case prettyRare (Int,Int,Int,Int,Int)
}
If this enum is going to be used by tens/hundreds of thousands of structs, am I actually saving any space by breaking out the rarer cases which store more data or is the footprint just equal to the largest case?
Thanks,
Jon
More information about the swift-users
mailing list