On Wednesday, 24 October 2012 at 15:39:19 UTC, thedeemon wrote:
The code DMD generates for initializing the struct does not use
loops, so it's
xor ecx, ecx
mov [eax], ecx
mov [eax+4], ecx
mov [eax+8], ecx
...
So your code creates a lot of work for the compiler.
That seems silly. I would think after the struct's init/contents
were known it would make a single block that holds the basic init
for it and bulk copy every time it needed it (if it's beyond a
certain size, say 32 bytes).
Also memset only works if the data can be defaulted to 0. Hmmm...