-
Notifications
You must be signed in to change notification settings - Fork 13
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
iszero type piracy causes a lot of invalidations #51
Comments
Thanks! That’s a bizarre one how that got there |
Thanks! It looks like I didn't import I'll fix it now. |
Never use |
I always use |
I'm also following the official convention advocated by StdLib: https://github.com/JuliaLang/julia/blob/395e47f4da4630a521333ad67eccf614c56aaf9c/stdlib/LinearAlgebra/src/LinearAlgebra.jl#L11 |
Most of the code in the stdlibs were written at a time when people didn't know better 🤣 |
I think introspection tools are a better way to go, say a GitHub action that does whatever it is you did to find these types of errors. Expecting developer style (and more importantly refactoring 100k's of existing Julia code) to prevent this is unrealistic. |
Accidental method extension is a problem So I stand by my advice to not use a way of coding which makes that easy. |
You might be right, but it's probably easier to get Julia to spit out a warning if a package overloads functions with types that do not belong to that package than it is to re-write every single Julia package in that style... (Yes I'm aware it's not so simple because of "sanctioned" overloading like OffsetArrays.jl, but I'm sure some macro could be introduced or something to stop the warning.) |
We're about to announce a competition on discourse...shhh, don't tell, this one is the current record-holder for the largest number of invalidations caused by a single method definition. A whopping 13% of all MethodInstances on Julia 1.6! No one who has read this is allowed to submit it, that honor goes to @KristofferC. |
I had no idea back in 2014 that my hacked together package would go on to cause so much damage to the Julia ecosystem... (And I guess given energy usage, the real ecosystem as well!) 🤯 |
No worries, we've all learned a lot in the last few months about this stuff. |
ImageCore had these: JuliaImages/ImageCore.jl#131. A mere 200ish invalidations, so I bow before your greatness, but no better from a piracy perspective. |
The worst part is I've spent literally weeks trying to debug why ApproxFun.jl loading was so slow via code-bisection.... was probably very close to finding this culprit |
How much did it change with this PR? |
Oh actually not that much, 15.1s v 15.3s... |
I think the biggest difference will be in sluggishness in the REPL and package manager etc after loading the package. |
Also, even with this fixed there is still a large number of invalidations going on (e.g. invenia/Intervals.jl#144). |
Yeah, in general when you fix an invalidation problem in PkgA, it's PkgB (which depends on PkgA) that will thank you. So if you're still thinking this package is really slow to load, start using |
I’m in the process of completely redesigning it via ContinuumArrays.jl which is much snappier already, so I won’t be looking into it |
The definition here:
ApproxFunBase.jl/src/Fun.jl
Line 506 in 6637707
changes the definition of
iszero
for all numbers (type piracy) and causes a huge number of invalidationsYou can see the effect of this by loading ApproxFunBase and notice that the whole julia session becomes sluggish while it is recompiling everything.
The text was updated successfully, but these errors were encountered: