Speeding up importing Phobos files
Arun Chandrasekaran
aruncxy at gmail.com
Tue Jan 22 00:46:32 UTC 2019
On Saturday, 19 January 2019 at 08:45:27 UTC, Walter Bright wrote:
> Andrei and I were talking on the phone today, trading ideas
> about speeding up importation of Phobos files. Any particular D
> file tends to import much of Phobos, and much of Phobos imports
> the rest of it. We've both noticed that file size doesn't seem
> to matter much for importation speed, but file lookups remain
> slow.
>
> So looking up fewer files would make it faster.
>
> If phobos.zip is opened as a memory mapped file, whenever
> std/stdio.d is read, the file will be "faulted" into memory
> rather than doing a file lookup / read. We're speculating that
> this should be significantly faster,
Speaking from Linux, the kernel already caches the file (after
the first read) unless `echo 3 > /proc/sys/vm/drop_caches` is
triggered. I've tested with the entire phobos cached and the
compilation is still slow. IO is not the bottleneck here. The
compilation needs to be speeded up.
If you still think the file read is the culprint, why does
recompilation take the same amount of time as the first
compilation (albeit kernel file cache)?
> being very convenient for the user to treat Phobos as a single
> file rather than a blizzard. (phobos.lib could also be in the
> same file!)
We already have std.experimental.all for convenience.
More information about the Digitalmars-d
mailing list