Makarius wrote:
On Wed, 17 Oct 2007, Andr?s P?hi wrote:
Agreed with your final conclusion, that it is generally faster. But stack space is limited compared to the amount of memory available, so there is a trade-off: use the stack for storage for speed, and limit yourself to the stack depth or use the storage memory with slower execution speed, but do not get caught by the stack space limit.
As I understand it, the memory model of the current CVS branch of Poly/ML gives you as much stack as heap, depending only on the size of virtual memory. In the presence of multi-threading, performance of stack should become even better compared to heap, because GC on the latter forces single-threaded execution.
Actually, there is a limit on the (ML) stack size even in the current CVS version. Each ML thread has a stack which is an object within the heap and the maximum size of an object is 2^24 words on a 32-bit machine i.e. 64 Mbytes (2^56 words on a 64 bit machine). Threads start off with small stacks and these can grow up to the maximum.
It might be possible to chain together stacks to increase the maximum stack size but there are a couple of problems that would need to be addressed. Maybe it's something to think about for version 5.2.
David.