Set max_methods 1 for several IO functions#60391
Set max_methods 1 for several IO functions#60391jakobnissen wants to merge 2 commits intoJuliaLang:masterfrom
Conversation
This reduces the number of invalidations of loading BufferIO.jl commit 957f141 from 1026 to 549. The large number of invalidations come from excessive world splitting on un-inferred IO objects, which, ironically, are probably intentionally left un-inferred to reduce unnecessary compilation. This is a poor bandaid solution: World splitting delenda est and all that. If that is not feasible, then an option to selectively disable it e.g. through a future `@max_methods 0` would impove the situation. For example, about 400 methods are invalidated due to the addition of a new `write(::T, ::Char)` method, which invalidates the single, world split `write(::IO, ::Char)` method. However, deeper fixes of this issue is outside the scope of this PR.
|
While you're at it, could we also do the same for |
|
That will broaden the scope of this PR beyond IO functions, since |
|
|
|
Yes, channels and timers also have a notion of opening / closing |
|
I pushed a small tweak that should make the failing test go through. |
|
Errors look to be network errors, AFAICT |
09cabd7 to
672cce5
Compare
|
xref PR #59377 |
| Read binary data from an I/O stream or file, filling in `array`. | ||
| """ | ||
| function read! end | ||
| typeof(read!).name.max_methods = UInt8(1) |
There was a problem hiding this comment.
What happens if a method of read! gets defined and a method instance gets compiled/inferred before you change max_methods here? Would it cause miscompilation?
This reduces the number of invalidations of loading BufferIO.jl commit 957f141 from 1026 to 549. The large number of invalidations come from excessive world splitting on un-inferred IO objects, which, ironically, are probably intentionally left un-inferred to reduce unnecessary compilation.
This is a poor bandaid solution: World splitting delenda est and all that. If that is not feasible, then an option to selectively disable it e.g. through a future
@max_methods 0would impove the situation. For example, about 400 methods are invalidated due to the addition of a newwrite(::T, ::Char)method, which invalidates the single, world splitwrite(::IO, ::Char)method.However, deeper fixes of this issue is outside the scope of this PR.