09-10-2008 04:30 PM
Hello,
What executes faster, add array elements of I32 or add array elements of double, assuming same size array?
Thanks.
09-10-2008 04:46 PM
You could try creating an example and benchmarking it each way.
If I had to guess, I32 would be quicker because you are only dealing with 4 bytes per element rather than 8 bytes per each double. But it may not matter at all.
09-10-2008 04:53 PM
rickford66,
This is the type of thing that can be easily benchmarked in LabVIEW (see attachments). Using the attached VI with array sizes of 10 million, I get a time of ~30 ms to add I32 and ~60 ms to add doubles. This makes sense, considering doubles are represented by 64 bits.
Chris M
09-10-2008 05:01 PM
09-10-2008 05:29 PM
rickford66 wrote:
I was referring to the add array elements function used to sum up all the elements in a single array.
Yes, DBL is about half the speed of I32 here too. (Still, be careful, because I32 will wrap when it overflows, so you might get very unexpected results.)
09-11-2008 06:29 AM - edited 09-11-2008 06:32 AM
I tried following benchmark 10 to 20 times and my results are surprisingly unexpected
For I32 time taken varied between 35 ms to 78ms (I didn't expected this much difference between two runs)
for DBL time taken wasn't very much different (40ms to 65ms)
Tushar Jambhekar
tushar@jambhekar.com
Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog
09-11-2008 06:58 AM
Tushar, I am not sure your benchmark is valid.
On my LV 8.5.1 system it shows me that your middle frame is being folded by LV, i.e. pre-computed. It takes 0 ms on my machine, which is what I would expect seeing as the middle frame effectively does nothing as you are not using the output of your summation.
09-11-2008 08:00 AM
I believe the answer to this question is very dependent on the hardware the benchamrk run on. The nauture of FPU (Floating point Unit) and the on chip-cache size compared to the data set size also will play a role in the performance.
Ben
09-11-2008 10:23 AM - edited 09-11-2008 10:31 AM
Tushar Jambhekar wrote:I tried following benchmark 10 to 20 times and my results are surprisingly unexpected
For I32 time taken varied between 35 ms to 78ms (I didn't expected this much difference between two runs)
for DBL time taken wasn't very much different (40ms to 65ms)
Your benchmark is completely useless, because the entire second frame is folded into a constant and thus does not really do anything in either case.
If you would enable folding display in your LabVIEW options, here's how it looks like:
09-11-2008 11:53 PM
I am not using LV8.5 but in case of labview 8.5 those constants can be converted to controls to avoid constant folding.
the timinmgs i have given are my actual observations
Tushar Jambhekar
tushar@jambhekar.com
Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog