LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ListInsertItem (from programmers toolbox) much slower in labwindows 8.5 than in 8.0.1

Hello,
 
I have noticed a large performance difference between the ListInsertItem function from the programmers tool box between 8.0.1 and 8.5.0.  The easiest way to see the difference is to use the sample code location at \National Instruments\CVI85\samples\toolbox\list.cws  Changing the number of items inserted into the list (line 99 in list.c) from 10 to 100000 and then compiling, there is a huge difference in the time the program takes to fill the list between the two difference version of labwindows.  From 8.0.1 it takes ~ 2 seconds to load up, while on 8.5.0 it took almost 3 minutes.  Adding a printf statement in there to watch as items are added makes it look like performance is progressively dropping for the 8.5.0 verison as items are added.  I have some code that utilizes the list functions, and this performance hit is a really big problem. 
 
Please let me know if you can reproduce it, and if so, if anyone has any suggestions on how to recover the performance seen under 8.0.1?  I haven't gone through and compared the two versions of the list routines, though I suspect that there were probably some changes made to it between 8.0.1 and 8.5.0.  Any help would be greatly appreciated.
 
Thanks,
 
Alex Corwin
0 Kudos
Message 1 of 2
(3,346 Views)

We fixed a bug in 8.5 that unintentionally introduced this performance issue. I am attaching a CVI 8.5.0 version of toolbox.c with a fix for this. This will be fixed in the next version of CVI. Basically, the change is in ListInsertItems.

Replace

    if (!ListPreAllocate(list, numItemsToInsert))
        return FALSE;
with

    if ((*list)->numItems + numItemsToInsert >= (*list)->listSize)
        if (!ExpandListSpace (list, -numItemsToInsert))
            return FALSE;


NOTE: It is better to make the above change manually if your version of toolbox.c has other changes or if you have a different version of CVI. If you decide to use the attached toolbox.c file, I recommend that you first diff it with your file to make sure there are no other differences. Also, you should recompile toolbox.c using Options >> Create Object File menu item in the Source Editor window to propogate the fix to the installed toolbox.obj files.

0 Kudos
Message 2 of 2
(3,329 Views)