I wonder the rationale behind the current implementation of STOP in NetLogo - if we are throwing, catching, and returning StopInterrupts, why should we do throwing and catching after all? It is much more expensive than simply returning a constant of a StopInterrupt object, both in CPU time and in memory consumption. On my model, it took 7% of the whole overhead and is the single largest overhead in the bottom-up view of Chrome's profiler.
It also leads to a further paradox when designing models:
Whenever you are using TO, if you want to use STOP and keep performance intact, you have to use TO-REPORT. Yet semantically, NetLogo does not allow calling a TO-REPORT without making use of the result (which is also a bit unintuitive to me, yet acceptable).
Yes, STOPs are preventable by restructuring the code in a certain way. Yet I wonder if there is a way we can improve it.
Hi all,
I wonder the rationale behind the current implementation of STOP in NetLogo - if we are throwing, catching, and returning StopInterrupts, why should we do throwing and catching after all? It is much more expensive than simply returning a constant of a StopInterrupt object, both in CPU time and in memory consumption. On my model, it took 7% of the whole overhead and is the single largest overhead in the bottom-up view of Chrome's profiler.
It also leads to a further paradox when designing models:
Whenever you are using TO, if you want to use STOP and keep performance intact, you have to use TO-REPORT. Yet semantically, NetLogo does not allow calling a TO-REPORT without making use of the result (which is also a bit unintuitive to me, yet acceptable).
Yes, STOPs are preventable by restructuring the code in a certain way. Yet I wonder if there is a way we can improve it.
Thanks!
Best, John Chen