Hi,
I’m reading the chapter about the pointers, I’m at Memory layout.
In the example of the book you have
struct IntBoolStruct {
var intValue: Int
var boolValue: Bool
}
MemoryLayout<IntBoolStruct>.size // returns 9
MemoryLayout<IntBoolStruct>.alignment // returns 8
MemoryLayout<IntBoolStruct>.stride // returns 16
And
struct BoolIntStruct {
var boolValue: Bool
var intValue: Int
}
MemoryLayout<BoolIntStruct>.size // returns 16
MemoryLayout<BoolIntStruct>.alignment // returns 8
MemoryLayout<BoolIntStruct>.stride // returns 16
I understand why it’s take more size.
My question is, in real app I need to take in consideration the orders of properties of my models if want to optimise memories? Or no need because it’s not expansive in memory?