has anyone hacked Clang or GCC to automatically zero C / C++ objects that would otherwise be uninitialized? would love to see the overhead
-
-
Replying to @johnregehr
cost of zeroing allocs is usually negligible IME, but did show up as relevant in my C compiler (mostly for AST nodes and similar...).
2 replies 0 retweets 1 like -
Replying to @cr88192 @johnregehr
For a good case where it isn't see https://git.musl-libc.org/cgit/musl/tree/src/string/strstr.c?h=v1.1.16#n38 …
1 reply 0 retweets 1 like -
Glibc avoids the base cost of zero-init by only using the table for needles >32byte, makes their strstr much slower for short needles.
1 reply 0 retweets 0 likes -
I used an uninitialized offset array and a cheap bit-array recording which slots of the former have been filled.
1 reply 0 retweets 2 likes -
Replying to @RichFelker @johnregehr
I don't follow; I was mostly dealing with the cost of doing "memset(tmp, 0, sizeof(BCCX_Node))" and similar when allocating nodes.
2 replies 0 retweets 0 likes
It's a 256-word (1k or 2k) array that's semantically initially zero, but sparsely accessed, & cost of fill is high rel to some calls.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.