Speeding up importing Phobos files
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Jan 20 15:10:58 UTC 2019
On 1/19/19 3:32 PM, Neia Neutuladh wrote:
> On Sat, 19 Jan 2019 11:56:29 -0800, H. S. Teoh wrote:
>> Excellent finding! I *knew* something was off when looking up a file is
>> more expensive than reading it. I'm thinking a quick fix could be to
>> just cache the intermediate results of each lookup, and reuse those
>> instead of issuing another call to opendir() each time. I surmise that
>> after this change, this issue may no longer even be a problem anymore.
>
> It doesn't even call opendir(). It assembles each potential path and calls
> exists(). Which might be better for only having a small number of imports,
> but that's not the common case.
>
> I've a partial fix for Posix, and I'll see about getting dev tools running
> in WINE to get a Windows version. (Which isn't exactly the same, but if I
> find a difference in FindFirstFile / FindNextFile between Windows and
> WINE, I'll be surprised.)
>
> I'm not sure what it should do when the same module is found in multiple
> locations, though -- the current code seems to take the first match. I'm
> also not sure whether it should be lazy or not.
>
> Also symlinks and case-insensitive filesystems are annoying.
>
> https://github.com/dhasenan/dmd/tree/fasterimport
This is great, looking forward to seeing this improvement merged. (There
are packaging- and distribution-related advantages to archives
independent of this.)
More information about the Digitalmars-d
mailing list