Bug 15323 – Module.members and .deferred3 should use data structure with fast lookup

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-12T21:05:00Z
Last change time
2016-10-01T11:46:19Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2015-11-12T21:05:07Z
On a moderately sized build (yes, per-package), iterating Module::members and Module::deferred3 over and over again to check whether they already contain a given template instance takes up a noticeable amount of time (about 5% and 3% of the total compilation time). The arrays should probably be replaced by a structure with sub-linear lookup for an easy compile-time win in template-heavy projects.
Comment #1 by bugzilla — 2016-04-22T21:45:17Z
Comment #2 by bugzilla — 2016-04-22T23:51:59Z
A better solution is have the template instance contain a field which has a pointer to which members[] it is contained in (since it is never contained in more than one).
Comment #3 by bugzilla — 2016-04-23T00:30:22Z
Comment #4 by github-bugzilla — 2016-04-23T18:26:20Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/cef279d5a192ca643593739661f385b1c3851106 fix Issue 15323 - Module.members and .deferred3 should use data structure with fast lookup https://github.com/dlang/dmd/commit/d57ca4c43ffa03628ed414b4a968acd63c4ef17d Merge pull request #5693 from WalterBright/fix15323 fix Issue 15323 - Module.members and .deferred3 should use data struc…
Comment #5 by github-bugzilla — 2016-10-01T11:46:19Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/cef279d5a192ca643593739661f385b1c3851106 fix Issue 15323 - Module.members and .deferred3 should use data structure with fast lookup https://github.com/dlang/dmd/commit/d57ca4c43ffa03628ed414b4a968acd63c4ef17d Merge pull request #5693 from WalterBright/fix15323