-
-
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
Add Libdl.LazyLibrary
#50074
Add Libdl.LazyLibrary
#50074
Conversation
cc5f4fe
to
77a5027
Compare
Honestly, I'm not 100% certain I even want I think if you want to close the libraries, you just need to be responsible for closing them yourself. |
d902efc
to
1b4ea85
Compare
Ugh, running into that windows problem where I can't |
x-ref: libuv/libuv#3839 |
597299d
to
93fe27b
Compare
I'm dodging the issue now by not re-using |
93fe27b
to
ca9c37d
Compare
ca9c37d
to
96afba8
Compare
Converting to draft while I figure out how to make the names lazier, so that we can use these with |
96afba8
to
c22a3d4
Compare
I worked this over with Valentin today, and we arrived to the current, rather overly-clever solution. It features a few very useful implementation details:
Things I'm still a little unhappy about:
I have a second branch that builds on top of this to make many stdlibs lazy, most importantly OpenBLAS_jll, and while it's a bigger change, it manages to get startup time down from 122ms -> 95ms on my macbook pro, and time to first matmul stays steady at 123ms. |
base/libdl.jl
Outdated
""" | ||
LazyStringFunc(f) = LazyString(_LazyStringFunc(f)) | ||
|
||
struct _LazyStringFunc <: AbstractString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct _LazyStringFunc <: AbstractString | |
struct _LazyStringFunc |
f320209
to
ef7a3f5
Compare
ef7a3f5
to
af20530
Compare
I've finished the Jameson refactor, and rebased my stdlib working branch on top of it, verifying it still works. We should be good to go here, as long as this goes green. |
@vtjnash So our change to no longer only call |
We should define that method and have it call a TypeError |
So you mean something like |
yes, like that |
5fa62bd
to
a91b772
Compare
This provides an in-base mechanism to handle chained library dependencies. In essence, the `LazyLibrary` object can be used anywhere a pointer to a library can be used (`dlopen`, `dlsym`, `ccall`, etc...) but it delays loading the library (and its recursive dependencies) until it is actually needed. This is the foundational piece needed to upgrade JLLs to lazily-load their libraries. In this new scheme, JLLs would generally lose all executable code and consist of nothing more than `LazyLibrary` definitions. As a helper type, we create a `BundledLazyLibraryPath` type that is stringable and calculates `Sys.BINDIR`-relative paths at runtime, and can be wrapped in a `LazyString` to act as an `AbstractString` if required. Many thanks to vtjnash for the Jameson Lock Makeover (TM).
a91b772
to
95191a2
Compare
This provides an in-base mechanism to handle chained library dependencies. In essence, the
LazyLibrary
object can be used anywhere a pointer to a library can be used (dlopen
,dlsym
,ccall
, etc...) but it delays loading the library (and its recursive dependencies) until it is actually needed.This is the foundational piece needed to upgrade JLLs to lazily-load their libraries. In this new scheme, JLLs would generally lose all executable code and consist of nothing more than
LazyLibrary
definitions.