-
Notifications
You must be signed in to change notification settings - Fork 16
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
vec(::Matrix)
allocates
#570
Labels
core
Related to the core utilities of the package
Comments
Are you sure that it's not free for |
julia> using BenchmarkTools
julia> @benchmark vec(M) setup=(M=rand(2, 3))
BenchmarkTools.Trial: 10000 samples with 999 evaluations.
Range (min … max): 12.624 ns … 5.056 μs ┊ GC (min … max): 0.00% … 98.51%
Time (median): 14.606 ns ┊ GC (median): 0.00%
Time (mean ± σ): 20.292 ns ± 98.337 ns ┊ GC (mean ± σ): 14.24% ± 3.10%
▃█▅▁▇▇▁ ▁▂▃▃▄▅▄▂▂▃▄▂ ▂▃▃▃▂▁▁ ▂
███████▇▇▆▆▆▆▇▇████████████▇▆▃▃▃▁▄▁▅████████████▇▆▅▅▅▅▅▆▅▆▆ █
12.6 ns Histogram: log(frequency) by time 36 ns <
Memory estimate: 32 bytes, allocs estimate: 1. |
Don't you need to use |
No because I create M in the setup phase, it is not a global variable. The interpolation of a global matrix variable would give the same result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As pointed out by @mcabbott in #564,
vec(::Matrix)
is not free. Neither isreshape
for that matter. He suggested directly usingReshapedArray
The text was updated successfully, but these errors were encountered: