Compile-time branching on type size between segregator members during segregator. allocate()

Per Nordlöw per.nordlow at gmail.com
Sun Sep 23 19:47:54 UTC 2018


After looking at

https://www.youtube.com/watch?v=kaA3HPgowwY

and

std.experimental.allocator.building_blocks.segregator.Segregator

I wonder if

     Segregator.allocate()

is missing an important optimization on calls to

     someSegregatorInstance.make!T()

where the choice of selecting the right segregator member can be 
done at _compile-time_ instead of run-time because `T.sizeof` is 
known at compile time. If so, what about adding an optional 
member to the allocator API, say,

     void[] allocate(size_t s)()

that can realize this idea?


More information about the Digitalmars-d mailing list