-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Regression in memory allocs when forming NTuple #41512
Comments
Fixed in #41074, but looks like we forgot to mark that for backporting. |
@simeonschaub I could reproduce with today's master. Note that type inference works, but still it allocates for me. Could you run my example just to double check? |
@simeonschaub this is how it looks on today's master for me: _ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.0-DEV.155 (2021-07-07)
_/ |\__'_|_|_|\__'_| | Commit 97f817a379* (0 days old master)
|__/ |
julia> Tuple3(itr) = NTuple{3, Float64}(itr)::NTuple{3,Float64}
Tuple3 (generic function with 1 method)
julia> function doit(itr);
for x in itr
Tuple3(x)
end
end
doit (generic function with 1 method)
julia> itr = [randn(3) for _ in 1:10000];doit(itr);
julia> @time doit(itr)
0.023238 seconds (120.00 k allocations: 2.899 MiB) |
Ah sorry, I misunderstood. Would be good to fix this. |
Base._totuple was inlined in 1.6, but isn't anymore. The cost is fine, and the method is even marked inline, so I guess it might be due to recursion detection? |
Seems to be fixed for me on 1.8.5. |
The following code allocates on master and 1.7beta2, but does not allocate on 1.6:
This lead to regressions in two packages for me:
https://github.com/jw3126/VoxelRayTracers.jl/blob/master/src/core.jl#L71
https://github.com/jw3126/LinearInterpolations.jl/blob/master/src/LinearInterpolations.jl#L407
https://github.com/jw3126/LinearInterpolations.jl/blob/master/test/test_LinearInterpolations.jl#L259
The text was updated successfully, but these errors were encountered: