-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent doing excessive file system checks in require calls #40890
Conversation
28994e9
to
4ea7216
Compare
I hope to have some measurements by this weekend. Thanks for your work on this. |
Might as well @nanosoldier |
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt |
Looks like there are some load path things that need to be looked at, but there also seems to be some big problems with PkgEval getting stuck when installing dependencies that I think are unrelated to this PR. |
Maybe I should hold off benchmarking then? |
Nah, the performance will be the same I'm pretty sure. I must just have missed something small. |
65571ab
to
eb6cb24
Compare
The bug should be fixed, let's try again @nanosoldier |
eb6cb24
to
1172c6b
Compare
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt |
Ref #40570
Some background on the code loading code:
The parsing of TOML files used to be implemented completely stateless. When asking for example what UUID a package the TOML parsing system would look through the TOML files line by line until it found it. Asking for another package, it would start from scratch again. This caused these files to have to be opened and closed a large number of times #27414 (comment).
In #36018 code loading was made to use a real TOML parser and in #37906 a cache was introduced to avoid having to reparse the same TOML file over and over.
However, a lot of the "statelessness" from the old code loading still exists. For example, every time
load_path
is called, Julia goes through the file system and looks around for project files. This is called many many times for a singleusing
call. One way to measure how much julia hits the file system is by running withstrace
and looking for differentstat
calls:Looking in the file we can for example see
being called over and over (corresponding to
julia/base/loading.jl
Line 133 in 27066a7
This PR assumes that within a single
require
calls, things like the load path, the content of Project files, etc will not change. This is a bit similar to the restriction we have on "world age".With this PR we get:
which is a quite significant reduction.
I admit that the implementation here is ugly but I consider this just as an ephemeral state of things for 1.7. For 1.8 I want to do a proper update of the code loading and do something similar that was started in #37632 to propagate path info to precompile workers so that only the main worker has to do any package location lookups.
@mkitti perhaps you could do some measurements on Windows and see if this improves #40570?