Compiler performance with my ridiculous Binderoo code

safety0ff via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 11 10:08:04 PST 2016


On Sunday, 11 December 2016 at 17:20:24 UTC, Stefan Koch wrote:
>
> That means you have to compute the mangled name which is crazy 
> expensive.
> And you can't cache the parent part of mangle because it all 
> freshly generated by the template.

How often would the mangle be needed regardless later on in 
compilation?
I don't know too much about dmd internals.
It seemed that Martin Nowak had a viable proof of concept, but 
the bugzilla discussion is quite terse.

>
> It seems like I fail to express the problem properly so let me 
> try again.
>
> AliasSeq's that are append to look like this
> : AliasSeq!(AliasSeq!(AliasSeq!(...)))
> An aliasSeq that is "appended to" n times will produce (n^2) 
> with ((n-1)^2) sub instances in them all the way till n is 0.
>
> When you want to compare their parameter times you need to go 
> through all of them and recursively call findTemplateInstance.

I don't see the n^2 instances, I'm likely missing an 
implementation detail.
However, I understand the quadratic nature of comparing:
AliasSeq!(AliasSeq!(AliasSeq!(...)))
to:
AliasSeq!(AliasSeq!(...))

I also don't see why you'd need to do this comparison often 
(assuming good hash functions are used.)
The comment "Hash collisions will happen!" seems to overestimate 
the current implementation IMO.


All in all, it would probably be best to have some degenerate 
code so that the issue can be investigated on a common footing.


More information about the Digitalmars-d mailing list