-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versionregression 1.9Regression in the 1.9 releaseRegression in the 1.9 release
Milestone
Description
Here's a small regression that is showing up pretty large in the RAI codebase (we have a global lock in our database pager that's way slower now).
Somehow accessing the fields of a global constant has become type unstable in some cases.
struct Wrapper
lock::ReentrantLock
end
Base.lock(f::Function, m::Wrapper) = Base.lock(f, m.lock)
Base.lock(m::Wrapper) = Base.lock(m.lock)
Base.unlock(m::Wrapper) = Base.unlock(m.lock)
const MONITOR = Wrapper(ReentrantLock())
function foo()
Base.@lock MONITOR begin
return 2+2
end
end
foo()
@time foo() # 0 allocs on 1.8, 1 alloc on 1.9The allocation only shows up when referencing the global const variable. It disappears if you pass it in as an argument:
function bar(x)
Base.@lock x begin
return 2+2
end
end
bar(MONITOR)
@time bar(MONITOR) # 0 allocs on 1.8, 0 allocs on 1.9This might be related to #50073, but i'm not sure.
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versionregression 1.9Regression in the 1.9 releaseRegression in the 1.9 release