Quoting Scott Hannahs <[EMAIL PROTECTED]>:

> At 12:24 -0400 6/4/04, Junginger, Johann wrote:
> >This is going to be a na�ve question after this thread has been going on
> for
> >so long, but can anyone send me (or point me to) a LV7 (or earlier)
> example
> >of recursion? It sounds very interesting but I am having trouble
> wrapping my
> >head around this concept.
> 
> <http://sthmac.magnet.fsu.edu/labview/vi_library.html>
> 
> Near the bottom of the page is a recursive calculation of the factorial
> function.  Versions in LV 6 and 6.1.  The factorial is a classic example
> of recursion since it is a trivial definition recursively.


Recursion has always struck me as an interesting concept without any real
use because of performance issues. In addition, recursive code is typically
hard to read.

It reminds me of these weird guys that run a marathon backwards with their
shoe laces tied together. It makes an interesting story but is not the best
way to approach the problem.

'glad you brought up your recursive demo. I compared it with my entry in the
recent LabVIEW Zone Coding challenge for factorials.

( http://www.ni.com/devzone/lvzone/codechallenge6_results.htm )

For "12!" it is 3000x slower (5 ms vs. 2 microseconds) while mine does more
because it formats the output to a string. Even weirder, if you take your
VI and put a simple FOR loop around the code (no indexing) and set the loop
counter to 2 so the core code executes twice, the VI takes 17 whole(!!)
seconds (4250000x slower/loop). Somebody better explain to me what's going
on here. (This is converted to LabVIEW 7.1 and saved before running).

Cheers
Christian


Reply via email to