Case Int, Int?
I realized that in the case of optional variables, a bit is needed to check if nil, so it comes out 1 byte larger.
But why is the memory size of String and String? the same?
Not only String, but also Array, Dictionary, and Set produce the same results.
Is it because they support Copy-on-Write? enter image description here
I searched Apple's official documentation, but couldn't find any results, so I'm asking a question.
Since optional is implemented by enum, When the associated value has a tagged pointer,
The extra bit required for the enum is stored in the spare bits of the tagged pointer.
https://forums.swift.org/t/how-do-i-implemented-a-tagged-pointer-in-swift/24729