[Issue 16513] Speed up TemplateInstance.findExistingInstance, hash by mangling
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Sep 20 03:13:34 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16513
Martin Nowak <code at dawg.eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gooberman at gmail.com,
| |uplink.coder at googlemail.com
--- Comment #1 from Martin Nowak <code at dawg.eu> ---
It's the horrible hash that is causing the performance issue.
Arguments as widely different than
genericIndexOf!(CPPMethods, ushort, int, uint, long, ulong)
genericIndexOf!(VTable, ushort, int, uint, long, ulong)
produce the same hash.
>From the 88.3K lookups, 7900 have the hash 1 (one).
The test code that triggered the issue contains 1K instances of
VariableDescriptor!(tonsofsimulatedobjects, SimulatedEntity,
"Simulated_Object_1063")
VariableDescriptor!(tonsofsimulatedobjects, SimulatedEntity,
"Simulated_Object_1064")
and lots of instances like
IsVariable!(Simulated_Object_963)
IsMemberVariable!(Simulated_Object_973)
isSomeFunction!(Simulated_Object_571)
IsVariable!(Simulated_Object_964)
IsMemberVariable!(Simulated_Object_974)
isSomeFunction!(Simulated_Object_572)
IsVariable!(Simulated_Object_966)
IsMemberVariable!(Simulated_Object_975)
isSomeFunction!(Simulated_Object_573)
all producing the same hash.
With such a crappy hash the behavior degrades back to the old linear search.
I'll try to replace this with the mangling suffix (.getIdent) instead which
should be both simpler and effective, given that all mangling bugs are fixed.
--
More information about the Digitalmars-d-bugs
mailing list