2 ms·
There’s a good history supporting that logic but I wonder if there were other trade offs: a couple of the comments around this mentioned better memory compressi
by acdha 4y ago
There’s a good history supporting that logic but I wonder if there were other trade offs: a couple of the comments around this mentioned better memory compression and some optimization work which made me wonder whether they might have been able to make zeroing faster than a pattern, especially if they’re going to have some generation of Apple Silicon add hardware support.
- syncsynchalt 4y agoMemory compression should handle any repeating initializer. I think they stuck with 0x0 because it keeps the performance of any calloc()-using object allocator the same (just moves the "when" of zeroing the chunk).
- syncsynchalt 4y agoAnswering myself: there's also an ARM opcode for zero'ing memory. That's another reason to use 0x0.
- acdha 4y ago> Memory compression should handle any repeating initializer. That’s what I’d think, too, but I wouldn’t be shocked if someone said they had some implementation detail which made it easier to work with zeroes. I know ARM has pretty good performance zeroing memory but that’s exactly the kind of thing where their hardware team might optimize what is now an extremely common operation.