03-23-2009 11:10 AM
03-23-2009 11:14 AM
Ben wrote:I just benchmarked the original sheme posted vs the inplace operation in a For loop (also as illustrated earlier) and the winner is....
The traditional method (original pattern) beating out the In-place/For loop version by a facto of 10X or more!
I'm still on LV 8.5 so I can't open the benchmark VIs, but this matches my experience. In place array operations (like replace array subset) are quite efficient in LabVIEW, but loops are not.
I wonder how much it could be improved with the primitive Wiebe suggested (or with the improved memory management as discussed before).
I recently had a similar problem, I had to convert a 24 bit array (represented as U32) to an "interleaved" 8 bit array (U8). I tried every possible method I could think of in G, but a C dll improved execution time by a factor of ~4. Just like Wiebe, I'd prefer not to use dll but plain G.
Daniel
03-23-2009 11:19 AM - edited 03-23-2009 11:20 AM
In this discussion I guess we miss something I have tried to illustrate in the picture below, and I somehow agree
03-23-2009 11:47 AM - edited 03-23-2009 11:48 AM
t06afre wrote:In this discussion I guess we miss something I have tried to illustrate in the picture below, and I somehow agree
Message Edited by t06afre on 03-23-2009 05:20 PM
I don't see what you mean and what this has to do with the discussion, but anyway your "equal" sign is wrong.
03-23-2009 12:10 PM
03-23-2009 12:17 PM
That picture is most decidedly incorrect, as you will discover if you put an indicator on both outputs.
The first will have an array of 100 elements, containing 0...99.
The second will have an array of 100 elements, all zeroes except for #99 which contains 99.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-23-2009 12:30 PM
Wiebe@CARYA wrote:
Here's another problem I'm having:
I tried to check the size, and then in a case add a second large array to
the pre-allocated array. But the case forces a buffer allocation every
cycle, so instead of gaining speed, it becomes dreadfully slow!
How does it behave if instead of adding a 2nd larger array, (I assume you mean by Build Array?), you use Reshape Array?
03-23-2009 01:57 PM
For this particular problem you could actually get away with calling LabVIEW:MoveBlock() in a Call Library Node. This is in fact the operation you are trying to get here from LabVIEW.
It is technically calling external code, but it is platform independant since you're calling to LabVIEW itself with this.
Rolf Kalbermattter
03-24-2009 03:34 AM
rolfk wrote:For this particular problem you could actually get away with calling LabVIEW:MoveBlock() in a Call Library Node. This is in fact the operation you are trying to get here from LabVIEW.
It is technically calling external code, but it is platform independant since you're calling to LabVIEW itself with this.
Rolf Kalbermattter
This sounds like a good approach. Is there any way to specify offsets? Basically we'd have to pass pointers to a specific element in the source and destination arrays. Let's say I want to copy elements 11-20 from source array to positions 31-40 in destination array. Can this be accomplished using MoveBlock()?
Daniel
03-24-2009 04:43 AM
If working with pointers, you can just add the offset to them. I think the offset was counted in Bytes (as is the Length in MoveBlock).
Felix