-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Random
: show
method for MersenneTwister
: invalidation resistance
#57913
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
Random
: show
method for MersenneTwister
: invalidation resistance
#57913
Conversation
Avoid using or constructing the vector with nonconcrete element type. Should make the sysimage more resistant to method invalidation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good change to me - printing immediately instead of accumulating in a temporary vector seems right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using ", "
instead of sep
might also be clearer, but it's a matter of taste at that point
The PR prevents these method invalidations: {
"method_instance": {
"method": "join(io::IO, iterator, delim) @ Base strings/io.jl:342",
"method_instance": "MethodInstance for join(::IOBuffer, ::Vector{Integer}, ::String)"
},
"children": [
{
"method_instance": {
"method": "show(io::IO, rng::Random.MersenneTwister) @ Random ~/tmp/jl/jl/nightly/share/julia/stdlib/v1.13/Random/src/RNGs.jl:143",
"method_instance": "MethodInstance for show(::IOBuffer, ::Random.MersenneTwister)"
},
"children": [
{
"method_instance": {
"method": "print(io::IO, x) @ Base strings/io.jl:32",
"method_instance": "MethodInstance for print(::IOBuffer, ::Random.MersenneTwister)"
},
"children": [
{
"method_instance": {
"method": "print_to_string(xs...) @ Base strings/io.jl:136",
"method_instance": "MethodInstance for Base.print_to_string(::String, ::Random.MersenneTwister, ::String)"
},
"children": [
{
"method_instance": {
"method": "string(xs...) @ Base strings/io.jl:189",
"method_instance": "MethodInstance for string(::String, ::Random.MersenneTwister, ::String)"
},
"children": [
{
"method_instance": {
"method": "_advance_n!(r::Random.MersenneTwister, n::Int64, work::Vector{Float64}) @ Random ~/tmp/jl/jl/nightly/share/julia/stdlib/v1.13/Random/src/RNGs.jl:783",
"method_instance": "MethodInstance for Random._advance_n!(::Random.MersenneTwister, ::Int64, ::Vector{Float64})"
},
"children": [
]
}
]
}
]
}
]
}
]
}
]
} |
Thanks @nsajko ! |
Avoid using or constructing the vector with nonconcrete element type.
Should make the sysimage more resistant to method invalidation.