Is there anything wrong with recursion?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
Hi,

I thought I read something before about recursion being slow in JASS (or risking breaking the map) but would just like to make sure there's nothing wrong with it.

The recursive function(s) I am thinking of using would have calls equal to the size of the problem set (O(n)) and the average size would be around 3-10...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,284
I think excessive recursion runs the risk of hitting a thread stack size limit (if it has one?). If you are using O(n) problems then it might be good to add a reasonable safety, eg n < 100 in case large input is given to it. This would prevent excessive performance degradation, thread crashes due to the op-limit and potentially let you catch some bugs.
 
Status
Not open for further replies.
Top