[Issue 13253] New: use more scoped imports in phobos
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Aug 4 11:12:15 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13253
Issue ID: 13253
Summary: use more scoped imports in phobos
Product: D
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
There are too many unconditional global imports in phobos.
This unnecessarily slows down compilation, especially when only a single symbol
of a module is needed. Recently I speeded-up dub [1] and found that just
importing std.conv (only for to!string(__VERSION__)) already took ~150ms.
Removing the import reduced the compile times for dub's compiler probe file [2]
to ~3ms.
There are some ideas to make (static) imports lazy and we have some root to
reduce the amount of work being done when importing a module (issue 13242).
We should still try to use more scoped (function-local) imports (better yet,
scoped selective imports). Not only will this reduce compiles times for most D
project, it also clearly specifies dependencies and helps to avoid no-longer
used imports.
[1]: https://github.com/D-Programming-Language/dub/pull/388
[2]:
https://github.com/D-Programming-Language/dub/commit/c9b685101cb5376d4ba4aa8ede4f8c9d346cd8de#diff-1c354aed609b1fe48ee6e2bb20fe396d
--
More information about the Digitalmars-d-bugs
mailing list