• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Is there anything wrong with recursion?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
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,255
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