[std-interval] Mathematical relations and default initialization

Ron Avitzur avitzur at PacificT.com
Thu Sep 14 16:54:04 PDT 2006


>if zero-initialization of memory is faster than initialization to
>something else.  I don't know if some platforms show such behavior.

Zero initialization of arrays can be much faster on PowerPC with the
dcbz instruction which zeros a cache line. This is much faster than
assigning the 0 value to memory because the assignment may first cause the
entire cache line to be read in from main memory which can be very slow.
That's unnecessary when the entire cache line is to be overwritten anyway.

Also, if I recall correctly on Mac OS X, the Mach kernel zero-fills
memory as a security feature when an anonymous memory page is used
for the first time.

However, I'm just responding to the specific question about
initialization to zero. I don't think this level of system-specific
performance lore is relevant to the discussion.


More information about the Std-interval mailing list