LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what executes faster, add array elements of I32 or add array elements of double

Hello,

What executes faster, add array elements of I32 or add array elements of double, assuming same size array?

Thanks.

0 Kudos
Message 1 of 12
(3,821 Views)

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.

Message 2 of 12
(3,813 Views)

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

Download All
Message 3 of 12
(3,808 Views)
I didn't think about benchmarking.  haha   Anyway, the example you posted isn't exactly what I was talking about.  I was referring to the add array elements function used to sum up all the elements in a single array.  It is likely, however, that it will have performance differences similar to your example.  I'm more of an embedded processor guy, and on 16 bit processors, it takes the same amount of time to add 8 bit numbers as it does 16 bits numbers.  I just wondered how a PC would process the numbers.  Thanks.
0 Kudos
Message 4 of 12
(3,802 Views)

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.)

Message 5 of 12
(3,795 Views)

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)

Message Edited by Tushar Jambhekar on 09-11-2008 06:32 AM

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

Download All
0 Kudos
Message 6 of 12
(3,747 Views)

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.

Message 7 of 12
(3,733 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 12
(3,711 Views)

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:

Message Edited by altenbach on 09-11-2008 08:31 AM
Message 9 of 12
(3,692 Views)

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

0 Kudos
Message 10 of 12
(3,662 Views)