More zero-initialization optimizations pending in std.experimental.allocator?

Stanislav Blinov stanislav.blinov at gmail.com
Sat Oct 20 15:25:46 UTC 2018


On Saturday, 20 October 2018 at 15:10:38 UTC, Nathan S. wrote:

> Other opportunities  would rely on being able to identify if 
> it's ever more efficient to write `memset(&x, 0, 
> typeof(x).sizeof)` instead of `x = typeof(x).init` which seems 
> like the kind of optimization that belongs in the compiler 
> instead.

Not unless `mem{set, cpy, move}` etc. are made into compiler 
intrinsics. Carrying libc dependencies into low-level sensitive 
code just stinks. If anything, the `memcpy` calls should be 
removed from `moveEmplace`, not `memset` calls added to it.
They're also not CTFE-able.


More information about the Digitalmars-d mailing list