Speeding up DCD in big projects
WebFreak001
d.forum at webfreak.org
Tue Jul 21 12:51:50 UTC 2020
So it turns out the `resolveImportLocation` function, which is
called on the first semantic pass, currently on Windows takes
like 50ms to complete once for just about 60 import paths. In a
big project like serve-d (as source code project) this would sum
up to over 7 minutes. (in release mode just around 2 minutes)
I optimized the import path check code and now in DCD debug mode
you might get a 83x speed up for your first completion and in DCD
release mode you might get a 26x speed up for your first
completion. In serve-d (as source code project) this translated
to the first completion now only taking 5 seconds.
I think in big projects optimizing the startup time too is pretty
essential and this was a very easy improvement I immediately
found using the debugger. The example times are made using DCD
~master with my dsymbol PR on and off inside the source code of
serve-d trying to auto complete extension.d:860
This was a very easy to find and improve spot, there might be
more low hanging fruit to get the first parse and completion even
quicker than 5s.
The PR: https://github.com/dlang-community/dsymbol/pull/151
More information about the Digitalmars-d
mailing list