new should lower to a template function call

Stefan Koch uplink.coder at googlemail.com
Thu Jul 23 18:51:33 UTC 2020


On Thursday, 23 July 2020 at 00:47:21 UTC, Andrei Alexandrescu 
wrote:
> Was thinking about this, see 
> https://issues.dlang.org/show_bug.cgi?id=21065.
>
> One problem I noticed with the current instrumentation of 
> allocations is that it is extremely slow. 
> https://github.com/dlang/dmd/pull/11381 takes care of that 
> trivially and quickly because it takes advantage of defining 
> one static variable per instantiation.

As Mathias has already point out in your issue.
You are instantiating more templates.

In the _worst_ case this can almost double the number of template 
instances.
I.E. when the new is inside a template itself.

What do you envision the prototype to be like, and why couldn't 
that be just a function call to the runtime if a hook exists?



More information about the Digitalmars-d mailing list