-
-
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
RFC: Per-project sysimage #35794
RFC: Per-project sysimage #35794
Conversation
Shouldn't this be recorded in the project file? |
I don't think it's a good idea to add it to project or manifest file because these files have to be portable. Whether or not you have a particular system image at particular path is machine-dependent. Also, it'd be a problem if you use the same project with multiple I'd like to treat system image as an optimization. Project environment should work with and without the system image. (Of course, there is a gray zone because the package included in the image have to be consistent with what is in the manifest. I think it'd be better to handle it in a more generic mechanism like #32906.) |
I'm wondering how this should interact with binaries? should the system image binary also be shipped with the package manager instead of building them locally? |
I'm designing the API to make it easier (via, e.g., artifacts; see the OP) but I think making it actually work is challenging, as not all packages are relocatable. |
The existing implementation in VS Code for this kind of functionality compares the last modified date of the |
I think it'd be better to solve it with a more generic mechanism like #32906. Checking the modified time of This design is about maximal flexibility and extensibility so that, e.g., you can distribute sysimage with the artifact system. |
Would it be possible to use a hash of the content of the whole environment stack, or something similar? |
Or maybe better a hash of the part of the environment stack that forms the transitive dependencies of the packages included in the sysimage? |
Frontends like VS code can implement such fancy checks on top of this PR. This PR is about maximal flexibility and composability. So, the checks like them are completely orthogonal to this PR. Also, note that everything has to be implemented in C (or C++ or scheme) because we can't use Julia before loading the system image [^1]. So, that's why I'm shooting for a very simple and flexible interface in this PR. [^1] OK, technically, we can do this in a subprocess or maybe even re-initializing Julia runtime is possible? But it sounds very tricky and fragile to me. |
As an aside this could allow for upgradable standard libaries, since those are baked into the system image. With a per-project dependent sysimage one could feasible update a standard library. We would need to give stdlibs independent version numbers, but that seems like the smallest issue. |
Would fix #36840 I think |
I think pkgimages has mostly superseded this. |
With this patch, you can do
To use
julia
with project-specific system image.Implementation/design
Given
--project=$projectdir
,julia
binary tries to read the text file$projectdir/.julia/sysimages/$slug.path
and use its content as the default--sysimage
argument. The$slug
is computed from the path ofjulia
binary. This way, it is safe to use multiplejulia
binaries with the same project.(Edit: it was pointed out that including
VERSION
inslug
as well might be a better idea JuliaLang/Pkg.jl#2008 (comment))This PR does not store the system image directly at
$projectdir/.julia/sysimages/$slug.$dlext
because the system image is rather large and it is nice to be able to use the same system image in multiple projects without copying the image file itself. Furthermore, it may make sense to distribute pre-compiled system image using the artifacts mechanism. It then is desirable to load system image directly from artifacts datastore rather than in$projectdir/.julia/sysimages
. Note that symbolic link is not a good option for supporting Windows.@staticfloat suggested to use triplet instead of
$slug
#33973 (comment) but this means to re-implement triplet detection in C. Furthermore, I don't think it is enough for supporting other variations ofjulia
(e.g., debug build, different versions). Hashing the path ofjulia
binary seems to be a simple robust solution.If the design is good, I can add some tests. Also, since I'm not a C programmer, I may be doing something stupid. Let me know if there is a better way to implement this.