LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Faster Execution ?

Hello All,

What is faster ? A formula node, an Expression node or creating the
equation with normal LabVIEW nodes ?

Thanks in advance,


Joao Araujo.
0 Kudos
Message 1 of 5
(2,976 Views)
"Joao Araujo" wrote in message
news:3CD00322.77031226@look.ca...
> 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.

regards
0 Kudos
Message 2 of 5
(2,976 Views)
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...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(2,976 Views)
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.

Gabi
7.1 -- 2013
CLA
0 Kudos
Message 4 of 5
(2,976 Views)
> 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.

Greg McKaskle
0 Kudos
Message 5 of 5
(2,976 Views)