On Friday, 19 October 2018 at 21:29:42 UTC, Per Nordlöw wrote:
Now that

    https://github.com/dlang/phobos/pull/6411

has been merged and DMD stable soon has the new

    __traits(isZeroInit, T)

found here

    https://dlang.org/changelog/2.083.0.html#isZeroInit

are there more zero-initializations that can be optimized in std.experimental.allocator?

I looked and identified low-hanging fruit in std.mutation.initializeAll & moveEmplace and in std.typecons.RefCounted (PR #6698), and in std.conv.emplaceInitializer (PR #6461). 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.

Reply via email to