Non-recursive maxSizeOf

Adam D. Ruppe destructionator at gmail.com
Thu Aug 6 02:01:36 UTC 2020


On Thursday, 6 August 2020 at 01:23:33 UTC, Per Nordlöw wrote:
> How does the memory usage and speed of this code compare to the 
> variant that uses template instantiations?

I haven't tested this specifically, but similar tests have come 
in at like 1/10th the memory and compile time cost.

There is one template instance here per argument list though, and 
that template includes the implementation function. The eponymous 
version Ali posted will perform a bit better than my version 
because the compiler can see it will never need code generation.

Still for small argument lists the Phobos one might do better, 
but for larger ones, the ctfe version should be much better. So 
on average Ali's version is almost certain to win in my 
experience.


More information about the Digitalmars-d-learn mailing list