On Friday, 23 February 2018 at 21:10:25 UTC, H. S. Teoh wrote:
On Fri, Feb 23, 2018 at 08:51:20PM +0000, Rubn via Digitalmars-d wrote: [...]
This slowdown for this specific example isn't cause by templates, it's caused by having to parse all the extra lines of code from phobos. I didn't say there aren't problems with templates, but this example accurately depicts nothing.

I say again, do you have measurements to back up your statement?

Parsing is actually very fast with the DMD front end. I can't believe that it will take half a second to parse a Phobos module -- the compiler's parser is not that stupid. I have a 1600+ line module that compiles in about 0.4 seconds (that's lexing + parsing + semantic + codegen), but that time more than doubles when you just change a loop into a range-based algorithm. Clearly, parsing is not the bottleneck here.


I did measure it, adding another instigation of the templates using a different type adds a fraction of the time. Not another 0.3 seconds.

I don't know what your so called 1600+ line module is doing, just cause it's 1600 lines doesn't mean there won't be the same slow down if you don't use part of phobos in all those lines. Then add a few lines that do use it, which will incur this slowdown.

Reply via email to