You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that lock(io::IOCustom) in combination with Groebner.jl wins the first prize for the number of method invalidations.
Running
# from https://sciml.ai/news/2022/09/21/compile_time/using SnoopCompile
invalidations =@snooprbeginusing AbstractAlgebra
R, (x,y) =polynomial_ring(QQ, ["x","y"], ordering=:degrevlex)
using Groebner
groebner([x^2- y^2, x*y^2+ x])
end
trees = SnoopCompile.invalidation_trees(invalidations);
@showlength(SnoopCompile.uinvalidated(invalidations)) # show total invalidations (1102)show(trees[end]) # show the most invalidated method
I get
inserting lock(io::AbstractAlgebra.PrettyPrinting.IOCustom) @ AbstractAlgebra.PrettyPrinting C:\data\projects\AbstractAlgebra.jl\src\PrettyPrinting.jl:1840 invalidated:
backedges:1: superseding lock(::IO) @ Base io.jl:26 with MethodInstance forlock(::IO) (621 children)
2: superseding lock(::IO) @ Base io.jl:26 with MethodInstance forlock(::IO) (4 children)
This is more than half of the total number of invalidated methods. I use AbstractAlgebra.jl from the master branch, but the issue seems to be present also for older versions.
At the moment, I am not sure why this happens, or how to fix this. Looks related: JuliaLang/julia#46878
The text was updated successfully, but these errors were encountered:
You don't really need the "Groebner" package, just do
invalidations = @snoopr using AbstractAlgebra
and it already reports a few hundred invalidations.
However, there is nothing wrong with our lock method as far as I can tell - the culprit is most likely the code calling lock. E.g. it may not be fully type stable. You can do
ascend(trees[end].backedges[1])
to find out more. Here is a screenshot to retain the colors:
As you can see, println is the "culprit" here. It is defined like this:
println(xs...) = println(stdout, xs...)
but stdout is a non-constant global, so this code is not type stable.
So I really don't see what we could do about it; as you already found out it is really an issue in Julia itself, as you found out.
It seems that
lock(io::IOCustom)
in combination with Groebner.jl wins the first prize for the number of method invalidations.Running
I get
This is more than half of the total number of invalidated methods. I use AbstractAlgebra.jl from the master branch, but the issue seems to be present also for older versions.
At the moment, I am not sure why this happens, or how to fix this. Looks related: JuliaLang/julia#46878
The text was updated successfully, but these errors were encountered: