12-13-2010 04:55 PM - edited 12-13-2010 05:00 PM
Hi,
I'm having a bit of a bottleneck issue using a circular array. What I need is a buffer like structure of doubles that will permit me to access an element at the end and run as efficiently as possible. I originally used a queue which took about 40 seconds to process a txt file I'm using for testing. I changed to a circular array and am now at 12 seconds total. I need to get it faster if I can as this single buffer accounts for about 75% of my runtime and is the single largest bottleneck.
Is there any other structure that I could use to keep a fixed size buffer and access the element at the end more efficiently? Am I implementing the array in the most efficient manner? I've attached my VIs and screenshots. "simplefixedbuffer" is the circular array, and "getNextCircularIndex" is the mechanism for updating the pointers to the beginning and end.
My assumption that this is the most efficient way to do this is based upon the belief that no copying of the entire array is taking place inside the native labview "Insert Into Array" function since I am enforcing a fixed size for the array. Please correct me if this assumption is wrong or if there is another insertion method I should use to avoid copying.
Thanks!
Solved! Go to Solution.
12-13-2010 05:05 PM - edited 12-13-2010 05:08 PM
You want replace subset not insert into array. You're also allocating an array of buffer size for every call.
12-13-2010 05:17 PM
Thanks a bunch! That cut my total runtime in half and that particular VI is not even showing up anywhere near the top consumer anymore. Kudos to you.
12-13-2010 05:38 PM
Here these might help as well
http://decibel.ni.com/content/docs/DOC-3414
http://zone.ni.com/devzone/cda/tut/p/id/7188
12-13-2010 06:15 PM
Feedback nodes make me uncomfortable...
This should be very fast...
12-13-2010 06:46 PM
Opps my examples were for a circular buffer. When he looks the poster wanted a delay.
A delay can be created with a feedback node (assuming the delay amount is known design time constant). In the rare times I use a non one delay I set the display to Z-transform form so it's clearer that it's not normal.
12-14-2010 04:42 PM
@Matt W - Fascinating.... but I still don't like feedback nodes.