Does selective imports have an effect on the resulting executable?
Dicebot
public at dicebot.lv
Thu Nov 28 06:01:47 PST 2013
On Thursday, 28 November 2013 at 12:31:11 UTC, Gary Willoughby
wrote:
> Does selective imports have an effect on the resulting
> executable? For example if i included the following at the top
> of my source to only include one function from a library:
>
> import std.algorithm : reduce;
>
> Would it have any impact on the resulting executable? i.e. only
> include compiled code for the selected functions?
>
> If i imported the whole library like this:
>
> import std.algorithm;
>
> Is it more wasteful? Not as optimised? Any draw backs? Bigger
> executable?
No, selective imports are just matter of namespace hygiene and
code readability.
Scope-local imports , however, can impact resulting executable a
lot if used inside templated scopes (nothing will be imported at
all if it is not instantiated)
More information about the Digitalmars-d-learn
mailing list