[Reading Notes] iOS-Tagged Pointer object-note, ios-taggedpointer
I. In September 2013, Apple launched the iPhone 5S. At the same time, the iPhone 5S was equipped with the first A7 dual-core processor with a 64-bit architecture. In order to save memory and improve execution efficiency, apple proposed the Tagged Pointer concept.
For 64-bit programs, the introduction of Tagged Pointer can reduce the memory usage by half, increase the access speed by three times, and increase the creation speed by 100 times.
2. When 8 bytes can carry the value used for representation, the system will generate a Pointer in Tagged Pointer mode. If the 8 bytes cannot carry the Pointer, then, we use the previous method to generate common pointers.
3. Tagged Pointer stores data directly in the Pointer by setting a special mark in its last bit. Because Tagged Pointer is not a real object, we need to be careful not to directly access its isa variable during use.
References: iOS development advanced-Tang Qiao