4 ms·
Turns out the allocations are just from the fact that the computation as written was not type stable. Making it so brings down the allocations to 2 and increase
by dklend122 6y ago
Turns out the allocations are just from the fact that the computation as written was not type stable. Making it so brings down the allocations to 2 and increases the relative speed to just under 2x.
Here's the post from chris:
"That’s not type-stable. x = [@SMatrix randn(5,5) for i in 1:10000] is a type stable way to compute an array of random SMatrices, and that nearly doubles the speed of the computation and removes the allocations down to 2, i.e. from:
2.549 ms (29496 allocations: 1.44 MiB)
to
1.469 ms (2 allocations: 390.70 KiB)
for me. Still a nice performance for Grassmann.jl, but seems to be <2x."