Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recursion very slow
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01086980
Message ID:
01087288
Vues:
29
Hi Ric,
It looks like that recursion calling slows things exponentially or something like that.... I wasn't aware of this issue.

I just did it iteratively, and it's much much faster.

Thanks for your time. And also thanks to Einar.

>Zakaria,
>
>I am not a mathematician, but the problem with slow recusrions are generally caused by two computing bottle necks:
>1. Stack management: The way the machine manages stacks of recursion varies from OS/Language to OS/language.
>2. Memory Management: (somewhat linked to the first reason) When the machine starts to swap memory to a physical medium (disk), it will exponentially slow down the process, since at that point in time the whole stack space is being swapped to/from diak.
>
>How do we deal with this issues:
>1. Turn off virtual memory on the machine, thus avoiding swapping to physical media. The trade off is that you will most likely get "Out of Memory" issues, but not always depending on the memory management of the OS you are using (XP and 2003 tend to be very forgiving).
>2. Trace the iterations (Iteration N/ Start time/End Time/Time Delta). You can set a public counter, set to -1 and increment by one everytime the function is called (the initial call with be zero, which is your entry point) and log this to the debug output window. Remember that the time values you want to evaluate are from Start Time n-1 to start Time n, and that end time will be a cummulative from first iteration to last (Start Time 0 to End Time n of iteration).
>
>Based on the numbers on #2 you will be able to trace at what point the bottle neck is taking place. Also, in VS 2003/2005 you can turn on code optimization.
>
>I hope this helps you somewhat.
Zakaria al Azhar
My blog on Actuaris.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform