06-13-2010 12:31 PM
06-13-2010 12:48 PM
06-13-2010 12:56 PM
Yamaeda wrote:
I did a small test program.
06-13-2010 04:44 PM
@altenbach wrote:Without seeing the code, I don't trust any benchmarks.(Even with full access to the code, I take such benchmarks with a grain of salt).At least show us the diagram or attach the program. 😉
Mah, i knew you'd say that. Ofc i forgot to save it, but this recreation is pretty identical (except the slider).
06-13-2010 05:31 PM
Yes, the difference is quite significant but probably not worth it. 80-90% of the loop timing is taken up by the random number generator, so if we subtract the time to generate the random numbers, the true difference is even bigger.
OTOH, we can see that any real computation will be significantly more dominant, making the empty loop differences insignificant in comparison. We would try to improve something that is only a very small percentage of any typical loop computation.
Interestingly, the autoidenxing loop has a bigger debugging overhead. Once we disable debugging, the differences are even bigger.
Results with an inner loop N=1000000:
autoindex: (69ms, 64ms*)
replace: (74ms, 72ms*) *second number is with debugging disabled
06-14-2010 04:09 AM
06-14-2010 09:27 AM
Prior to LV 6i the preallocate and replace was faster.
As of LV 6i, a lot enhancements where implmented such that the For loop will preallocate the buffer when it starts and is slight faster than coding it up the hard way.
Ben
06-14-2010 09:55 AM
06-14-2010 10:06 AM
There is no LabVIEW version 2.9. 2009 perhaps?
What you are doing will not work. You are inserting elements into empty arrays. This only works if the index is zero and not for random indices. All you probably need to do is use "built array" with two inputs (value and time) and append the resulting 1D array to your spreadsheet.
Please attach your actual VI so we can give you some useful tips on how to do it better.
06-14-2010 11:05 AM