Hacker News new | past | comments | ask | show | jobs | submit login

StaticArrays.jl will create arrays that are stack allocated and optimized just like in Eigen. There are no temporaries in that example.

Even if you used MArrays, which are small statically sized mutable arrays, the intermediate temporary arrays would live on the stack and thus not cause any allocations.




I suppose I should caveat my grandparent comment by saying that StaticArrays and MArrays are only good up to 14 x 14, if memory serves me correctly. That rule of thumb might be out of date; the compiler might construct large tuples more efficiently these days.


I believe Eigen has similar problems, but im not sure.

However, there is work happening for large stack allocated arrays in julia. StrideArrays.jl can create stack allocated arrays that work on any size that will physically fit on the stack.

https://chriselrod.github.io/StrideArrays.jl/dev/stack_alloc...

This package is work in progress though and has some rough edges.


That's exciting news :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: