Compile / runtime differences for using import statements

Selim Ozel sozel at wpi.edu
Thu Apr 20 23:04:14 UTC 2023


I've been wondering if there is any difference between importing 
a function/component from a module as stand-alone or importing 
the whole thing makes any difference.

Just looking at the assembly output in godbolt suggest they 
create same instructions but I wonder if it makes any difference 
at compilation/linking etc.

https://godbolt.org/

```
// Import writeln individually
import std.stdio: writeln;

void main() {
     writeln("hi");
}

// Import all std.stdio
import std.stdio;

void main() {
     writeln("hi");
}
```


More information about the Digitalmars-d mailing list