www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13253] New: use more scoped imports in phobos

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 puremagic.com
          Reporter: code 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

--
Aug 04 2014