11-12-2009 12:54 PM
11-12-2009 02:20 PM
You can answer such questions yourself with a timing tool:
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-12-2009 02:26 PM
11-12-2009 11:36 PM
Not for your specific case. And that's because Replace Array Subset doesn't take a 2D array as the new element/subarray if the input array is 2D. This means that you need to replace by rows/columns as your method 3 does. In each of your methods the outer for-loop is simply running the same method N times. When you remove this we see that we're left with basically a single operation for the Insert Array method, a few operations for the Build Array method, but a whole loop for the Replace Array Subset method (which has a Build Array inside the loop to boot). This last method will take longer in this specific case.
Preallocation and use of Replace Array Subset is useful as an alternative to using Build Array inside a loop to create an array. This does not mean that it's the most efficient method in all cases. As always, the task to be accomplished dictates which method is the most efficient method.
11-13-2009 02:07 AM