News for hackers. Stuff that matters.
Re:Optimizing Ray Tracing in Haskell by snawaz on Monday July 20, 2020 @04:50PM (#23901756)
> In the case of an image of this size you could probably just put everything on the stack.

That sounds interesting and will probably make it more efficient. But how do I put things on the stack? As per this answer on Stackoverflow, the runtime allocates memory on the heap to call functions (and probably programmers don't have any control over that?):

https://stackoverflow.com/a/5132862/415784

Re:Optimizing Ray Tracing in Haskell by CyberDildonics on Monday July 20, 2020 @05:46PM (#23902250)
I don't know how to avoid heap memory allocations in haskell or make sure memory is on the stack, but both are very easy to do in C++.
Re:Optimizing Ray Tracing in Haskell by snawaz on Monday July 20, 2020 @06:19PM (#23902480)
>I don't know how to avoid heap memory allocations in haskell or make sure memory is on the stack, but both are very easy to do in C++.

Yup. I know it's easy and the default behavior in C++.

This Haskell page says, it is pretty common to allocate and deallocate memory immediately, and that GHC handles this pretty efficiently, which probably explains why Haskellers dont seem to care about this (though it seems weird to me).

https://wiki.haskell.org/GHC/Memory_Management