Recursion. Is it a big performance impact in amxx?
Hi. Let's say that I need recursive function and the maximum times it calls itself is about 15.
Two questions:
Code:
gcd(a,b) { |
Re: Recursion. Is it a big performance impact in amxx?
|
Re: Recursion. Is it a big performance impact in amxx?
Assuming your function is trying to find the greatest common denominator, you can use the following:
Code:
gcd( a, b ) |
Re: Recursion. Is it a big performance impact in amxx?
Some time ago I had the same question.
I think using stock for recursion will be better than a function. I don't have an example, but think in a recursive stock/function that runs over a graph (to find all relations, bigger, best route, etc). Of course the size of graph will be the key performance. |
Re: Recursion. Is it a big performance impact in amxx?
Quote:
|
Re: Recursion. Is it a big performance impact in amxx?
Quote:
But as you can see recursive function should be the best solution. |
Re: Recursion. Is it a big performance impact in amxx?
I found function very fast.
Thank you all for your help. |
Re: Recursion. Is it a big performance impact in amxx?
Quote:
|
Re: Recursion. Is it a big performance impact in amxx?
It's probably this:
PHP Code:
|
Re: Recursion. Is it a big performance impact in amxx?
Solution so to say is what I first posted:
Code:
gcd(a,b) {Code:
200,195Code:
type |name | calls | time / min / maxEDIT: I find recursion much more elegant than while loop. |
| All times are GMT -4. The time now is 07:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.