"Joao Araujo" wrote in message news:3CD00322.email@example.com... > Hello All, > > What is faster ? A formula node, an Expression node or creating the > equation with normal LabVIEW nodes ? > > Thanks in advance, > I just created a little VI to look at these, (you could have done one yourself by now), and came up with the following results.
The VI first filled a 10^6 element array with random numbers, then started a timer and used a for loop to step through the array, squaring each number as it went. After the loop it stopped the timer and gave the time in ms.
Squaring each number by:
Wiring both inputs on a multiply VI together ---- 98ms Formula node y=x*x; ---- 197ms Formula node y=x**2; ---- 730ms Expression Node x*x ---- 98ms Expression Node x**2 ---- 640ms
So I'd say that, for this simple bit of maths, the expression node and the Labview Nodes came neck and neck with a formula node a poor third behind.
See how it looks on your problem. Its really easy to do some experiments.
Actually things might be worse for the formula node than you show because in your example, normal math nodes and expression nodes are polymorphic and so don't need to be inside a loop. They accept array inputs.
It would be interesting to see more extensive comparisons because I have heard that in certain conditions formula nodes are much faster than conventional math nodes. One of those things that I keep meaning to look into one of these days...
Certified Professional Instructor Certified LabVIEW Architect LabVIEW Champion
Your tests show only half the truth. For array operations it is certainly true, that you are fastest, when you find some of Labview's own vi's that deal with arrays as an object. As soon as you have to index arrays inside a labview loop, it gets terribly slow and you end up much faster doing the indexing and processing inside a formula node. And if you have a C Compiler at hand, even think of doing numeric processing in a CIN.
> Your tests show only half the truth. > For array operations it is certainly true, that you are fastest, when > you find some of Labview's own vi's that deal with arrays as an > object. > As soon as you have to index arrays inside a labview loop, it gets > terribly slow and you end up much faster doing the indexing and > processing inside a formula node. > And if you have a C Compiler at hand, even think of doing numeric > processing in a CIN.
I wouldn't describe the indexing as terribly slow.
The GMath VIs are written using mostly the nodes and they are quite fast. My experience has been that the nodes are quite similar in speed, especially when the debugging is turned off.
In general I'd say that you should use the represen tation that you find easiest to read and not worry about the performance until you see that there is a problem. Then use the profiler to find the hot spots.