-
Notifications
You must be signed in to change notification settings - Fork 221
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
docs: perf tips: deemphasize assume
in favor of UnsafeAssume.jl
#2181
base: master
Are you sure you want to change the base?
Conversation
The new package is dedicated to functionality like `assume`. It has documentation and examples, and the functions have better effects as appropriate depending on the Julia version. For example, the new package preserves a `nothrow` effect of the calling code. Unreleased versions of Julia are able to eliminate `try`-`catch` constructs when `nothrow` is known.
Appreciate the intent, but I'm not convinced. UnsafeAssume.jl is a very new package, with IMO a rather clunky API, imposing additional constraints on user code like the requirement to inline. For such a niche performance hack, it doesn't seem worth the additional dependency. If anything, that functionality should now move to a Julia intrinsic, so that the Julia optimizer can also reason about the added information (and lower it to an LLVM assumption afterwards). |
The API is the same, or rather it's a superset of the
This actually isn't an additional constraint, it's just that I documented it. See the explanation here: https://discourse.julialang.org/t/why-does-arrayref-throw/104283/90?u=nsajko
OK, your call. It seems to me that moving the functionality into a dedicated package is a good thing.
🙏, but I'm not holding my breath. |
I would encourage you to contribute. Adding an intrinsic is a relatively small change. |
Putting it in a separate package would be a good opportunity to improve the interface though. In the case of LLVM.jl, we don't aim to offer anything but a shallow layer over LLVM, so the
I don't see how that applies to |
I've been thinking about the "make this an intrinsic" proposal, and actually I realized that's not necessary. All that's necessary is for Julia to eliminate known-unreachable (
I thought it was fine? It's the same interface that Rust and C++ have, and I can't envision any significantly different low-level functions than
That was kind of the point. I resent the fact that functionality like
I haven't looked into this deeply, so I'm just guessing TBH, but I think it may not be enough for just |
How would you emit a |
My So |
Not so sure anymore. The problem is that the |
The new package is dedicated to functionality like
assume
. It has documentation and examples, and the functions have better effects as appropriate depending on the Julia version. For example, the new package preserves anothrow
effect of the calling code. Unreleased versions of Julia are able to eliminatetry
-catch
constructs whennothrow
is known.