Splitting std.algorithm

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 22 11:29:16 PST 2015


On Thursday, January 22, 2015 19:12:55 Dicebot via Digitalmars-d wrote:
> DMD FE memory issues are almost fully because of template
> instance explosions and CTFE. Micro-optimising structure layouts
> is a bad way to fix it.

I forget what the numbers were, but IIRC, when Don looked at that a while
back, he found that templates like isForwardRange were being instantiated
millions of times as part of the unit tests. And maybe the numbers weren't
quite that high, but they were _high_. std.datetime used to have similar
problems when I used assertPred for its unit tests, which was a very handy
templated function for making unit tests more informative, but it was a
template, and it was used a lot in the tests, so it wasn't cheap, and once
it was removed, the memory consumption and time to compile definitely went
down.

It would be a huge win if we could figure out how to avoid having all of
those templates instantiated that many times.

- Jonathan M Davis



More information about the Digitalmars-d mailing list