bsvingen Posted June 18, 2006 Report Share Posted June 18, 2006 Well, after discovering that an inline method already exists by default in LV (scripting), and with thanks to Jim Kring for pointing me to the traverse tool in LV8, the inline tool became much smaller and simpler. Basicly what it does is to inline all sub VIs with __inline in their names (double underscore in front of inline. I don't know if this is the best option, but it works). It uses the NI tool to traverse the diagrams, while the main loop will recurssively loop through all sub VIs. inline VIs can therefore be inside other inline VIs, and the tool will just go through the complete hierarchy. It will not touch any locked files. I could have added some statistics etc, but i have no use for that myself, so you have to add that if it is needed/wanted. Download File:post-4885-1150641218.zip Link to comment
bsvingen Posted June 18, 2006 Author Report Share Posted June 18, 2006 Here is an example of improvements in execution speed with inlining. In general inlining is useful when you have lots of small numerical formulas that have to be executed often, for instance when you have two or more arrays and have to do some more or less complex operations on array element basis. This is typical for most data analysis applications. With inline functions the code maintains the modularity (readability) while all the overhead associated with sub VI calls disapears completely. The increase in execution speed can be dramatic for some applications (several hundred percent), while for others no practical increase is seen. When inlining, the the code becomes very unreadable, so it is only usefull to gain execution speed when the code or sub-parts of the code is finished. A copy of the un-inlined code must therefore be stored for later modifications. Here is the execution speed before inlining. The inline sub VI has the same execution speed as an ordinary sub vi (they are identical ). The one stored/compiled as subroutine performs more than twice as good as the other two. After inlining, the picture is different. Now the inlined code perform almost twice as good as the subroutine, and about 350% better than an ordinary sub VI. This is the effect of one single inline function. For more complicated formulas where the code needs to be broken down into several sub VIs, the improvement will be even more. (Actually the equations in this example are so simple that faster execution speed is obtained by feeding the arrays directly, but that is beside the point and only shows that too simple examples are not allways the best examples ) Download File:post-4885-1150670897.zip Link to comment
LAVA 1.0 Content Posted June 21, 2006 Report Share Posted June 21, 2006 I have to try it out in one of my very performance hungry applications. Hmm.. I wonder if this works together with the new GOOP Developer... Link to comment
Mike Ashe Posted June 30, 2006 Report Share Posted June 30, 2006 bsvingen, Thanks very much for posting both your final solution and the benchmarks. Very significant. Lastly, did you ever do any of your work in LV 7? Obviously the 8.0 Traverse tool/method will not work for 7 (then again, I didn't try to revert it to 7, but I suspect it won't.) There are still a very significant portion of the LabVIEW community that still use 7.x and I think they would benefit from your solution if it was finalized with the diagram coloring method. Again, thanks and good job! Scratch my paragraph above, I had not yet seen this post for your LV 7.1.1 version so please forgive the above. Thanks again & great job! Link to comment
Kurt Friday Posted June 30, 2006 Report Share Posted June 30, 2006 Hey bsvingen Nice work, very cool. I'll have a play with this and give you some feedback, the drop in execution time is quite impressive. Link to comment
JCFC Posted August 5, 2009 Report Share Posted August 5, 2009 My project use SubVIs from OpenG, NI Database Toolkit, and NI Report Toolkit, when I use it in a top VI, the Inliner open a lot of VIs (it seems that open all VIs that aren't Locked/PW protected but doesn't close them) Maybe the Inliner can be modified to secure the code: Link to comment
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now