02-16-2012 03:56 AM
I'm using TS2010/CVI2010 to code steps types and sequences, and I had some interrogations when thinking about making functions prototypes "homogeneous".
I wondered if this is any difference in terms of speed between passing step variables directly as arguments to a CVI function, and accessing them in the CVI code module using the TS API.
What could be the other differences, e.g. concerning compatibility and modularity.
02-16-2012 06:45 AM
Passing any parameters into the code module has got to be quicker than obtaining them via TS API calls inside the code module. Also as you are using a C based language, obtained a set of parameters is going to be a serial activity, whereas passing them as part of the code module call, the data will be available once inside the code module.
There is the argument that you should always pass the SequenceContext but I believe you should only do this if you are actually are going to use TestStand API and if you have design your code module so it doesn't need to use the TS API then why pass it,
Once you pass the SequenceContext into the code module and use the TestStand API, then this code module can not be used outside of TestStand.
02-16-2012 10:20 AM - edited 02-16-2012 10:20 AM
The performance should not be significantly different in most cases. It will depend somewhat on how and what kind of data you are accessing though. For example if you really want a string as an ANSI string, using the API is slightly less efficient since it will require a conversion to and from unicode, however unless the strings are huge, this is not that significant. Also for arrays, if you access each element with a separate API call that is less efficient than getting the whole array as a raw C array. You can get the whole array via the API too though by using GetValVariant(), however it will be as a safearray which is not the easiest data structure to use.
Hope this helps,
-Doug