Quote:
Originally Posted by jman4747
Also do formula nodes execute faster than the equivalent code on the block diagram?
|
They will generally be the same, however some operation such as arrays may actually take longer in the formula.
The formula and the nodes both feed into the same compiler, but with different front ends. By comparison, FPGA VIs start with the same front end and finish with different back ends.
The front end may need to parse text in order to identify types and operations. Or for nodes, it simply visits the nodes since this is already determined in the editor. The generator will then produce intermediate code for the representations, and then it will send the intermediate code through the LLVM back end.
I did a quick measure averaging random numbers and saw that the scalars were almost the same. The formula for accessing elements of four different arrays and storing in a fifth was about 50% more expensive in the formula node. I personally wouldn't read too much into that, since I was using the indexing tunnels on the LV diagram, so that probably gave the diagram simpler code to generate.
Generally, I try to write code that is the most understandable. I measure performance quite often, but I try to achieve it by using the proper algorithms, understanding what the major operations are in the algorithm, then make minimal edits or data structure changes in order to gain performance. Sometimes the more understandable code is a formula, sometimes not.
Greg McKaskle