Reduce uses of windows.d b/c it's slow (see PR #2336)#2400
Reduce uses of windows.d b/c it's slow (see PR #2336)#2400thewilsonator merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request, @n8sh! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + druntime#2400" |
|
I can also do this in |
dcb306a to
6de9e9d
Compare
import is private by default, so only "public imports" might be affected. Selective imports do create public symbols, though (albeit deprecated). So this could be a breaking change causing ambiguities before the deprecated behaviour is removed from the compiler. It might be less invasive to not list imported symbols (while mostly desirable in general some lists look a bit excessive). Do you have some example numbers what the compile time improvements are? |
Didn't know that, thanks. This PR should not be merged before I fix this.
I assumed there would only be a noticeable speed difference with uncached reads from a non-SSD drive (I'm assuming the main speed penalty from importing windows.d is opening ~32 other files), but benchmarking would still be a good idea. |
|
Ping @n8sh |
6de9e9d to
ebd96a5
Compare
|
@thewilsonator removed top-level selective imports as @rainers recommended. I also did an informal benchmark with a non-optimized DMD development build. Compiling the following program went from 640 milliseconds (best of 40 tries) to 240 milliseconds (best of 40 tries): import core.internal.abort;
import core.runtime;
import core.sync.condition;
import core.sync.mutex;
import core.sync.semaphore;
import core.sys.windows.httpext;
import core.sys.windows.snmp;
import core.sys.windows.threadaux;
import core.thread;
import core.time;
void main(string[] args) {} |
|
That was a more noticeable difference than I expected. I'll remove the remaining imports of |
ebd96a5 to
82fe176
Compare
82fe176 to
12f64a0
Compare
In general avoided removing non-privatecore.sys.windows.windowsimports from othercore.sys.windows.*header files so imports-of-imports from them will not break. The exception iscore.sys.windows.threadauxbecause it is imported bycore.thread.