Compiler performance with my ridiculous Binderoo code
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Sun Dec 11 09:20:24 PST 2016
On Sunday, 11 December 2016 at 17:04:24 UTC, safety0ff wrote:
> On Sunday, 11 December 2016 at 16:26:29 UTC, Ethan Watson wrote:
>>
>> At the very least, I now have an idea of which parts of the
>> compiler I'm taxing and can attempt to write around that. But
>> I'm also tempted to go in and optimise those parts of the
>> compiler.
>
> Have a look at this issue:
> https://issues.dlang.org/show_bug.cgi?id=16513
>
> In a nutshell:
> Dmd puts template instances in an AA using a terrible hash
> function.
> When looking for a match it does an expensive comparison for
> each collision.
>
> The hash function is easily fixed but it does not obviate the
> expensive comparison, so it trades hashing time for comparison
> time. Therefore the performance impact of fixing it is unclear.
> Martin Nowak is suggesting that using the mangled name is the
> way forward.
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.
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 thier paramterter times you need to go
through all of them and recursively call findTemplateInstance.
More information about the Digitalmars-d
mailing list