Bug 13253 – use more scoped imports in phobos

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-04T18:12:15Z
Last change time
2024-12-01T16:22:06Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: phobos#10078 →

Comments

Comment #0 by code — 2014-08-04T18:12:15Z
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
Comment #1 by dbugreporter — 2014-08-28T07:57:52Z
Beware of issue 10378 though. Using scoped imports means you have to be aware of every symbol in that module or you'll risk surprising behavior since there is no conflict detection.
Comment #2 by code — 2014-11-07T15:31:03Z
Comment #3 by ilyayaroshenko — 2014-11-07T20:57:36Z
Comment #4 by ilyayaroshenko — 2014-11-07T21:41:26Z
Comment #5 by ilyayaroshenko — 2014-11-08T23:53:30Z
Comment #6 by ilyayaroshenko — 2014-11-09T15:04:22Z
Comment #7 by ilyayaroshenko — 2014-11-10T12:31:01Z
Comment #8 by ilyayaroshenko — 2014-11-10T13:44:49Z
Comment #9 by ilyayaroshenko — 2014-11-13T09:52:53Z
Comment #10 by ilyayaroshenko — 2014-11-13T14:56:14Z
Comment #11 by ilyayaroshenko — 2014-11-14T05:26:13Z
Comment #12 by ilyayaroshenko — 2014-11-20T18:49:29Z
https://github.com/D-Programming-Language/phobos/pull/2705 https://github.com/D-Programming-Language/phobos/pull/2706 https://github.com/D-Programming-Language/phobos/pull/2707 https://github.com/D-Programming-Language/phobos/pull/2708 https://github.com/D-Programming-Language/phobos/pull/2709 https://github.com/D-Programming-Language/phobos/pull/2710 https://github.com/D-Programming-Language/phobos/pull/2711 https://github.com/D-Programming-Language/phobos/pull/2712 https://github.com/D-Programming-Language/phobos/pull/2713 https://github.com/D-Programming-Language/phobos/pull/2714 https://github.com/D-Programming-Language/phobos/pull/2715 https://github.com/D-Programming-Language/phobos/pull/2716 https://github.com/D-Programming-Language/phobos/pull/2717 https://github.com/D-Programming-Language/phobos/pull/2718 https://github.com/D-Programming-Language/phobos/pull/2719 https://github.com/D-Programming-Language/phobos/pull/2720 Use scope imports in std.container package https://github.com/D-Programming-Language/phobos/pull/2721 https://github.com/D-Programming-Language/phobos/pull/2722 fix binaryFun https://github.com/D-Programming-Language/phobos/pull/2723 https://github.com/D-Programming-Language/phobos/pull/2725 https://github.com/D-Programming-Language/phobos/pull/2726 https://github.com/D-Programming-Language/phobos/pull/2727 https://github.com/D-Programming-Language/phobos/pull/2728 https://github.com/D-Programming-Language/phobos/pull/2729 https://github.com/D-Programming-Language/phobos/pull/2731 move format to std.format https://github.com/D-Programming-Language/phobos/pull/2732 https://github.com/D-Programming-Language/phobos/pull/2733 https://github.com/D-Programming-Language/phobos/pull/2744
Comment #13 by andrei — 2017-12-20T00:35:23Z
Comment #14 by robert.schadek — 2024-12-01T16:22:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10078 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB