Fixed u_arraylist to correct performance and missing calls.
authorJon A. Cruz <jonc@osg.samsung.com>
Sat, 15 Aug 2015 07:09:17 +0000 (00:09 -0700)
committerJon A. Cruz <jonc@osg.samsung.com>
Thu, 27 Aug 2015 04:22:40 +0000 (04:22 +0000)
commit8b133a8a1b3d082aa9e775d6cc16b6862a2da650
tree4e8e25c28e99eb0d63a2237969b14b682f892d1c
parent20ddce3604fecc8a99fe0a8e28a813e475f65dd0
Fixed u_arraylist to correct performance and missing calls.

Corrected poor memory management to not realloc() on each remove
call, use a normal approach to growth of the backing store, and
some general cleanup. Added calls for reserving space and for
requesting reduction of the backing store.

These were all issues called out in the intial code review.

Simple cleanup improved performance of the contains function
reducing its time by 40%-50% (~ 36ms down to 21ms-19ms).

With the backing store corrections, repeted add/remove testing was
improved with its time being cut by 75% (36.8ms down to 9.4ms).

(Times should be taking as very rough, since runs were done using
valgrind to slow things enough to actually measure.)

Change-Id: I81e42f2fdbec8fb7fb18f16f09cfa5008640a2d4
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2293
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Tested-by: Habib Virji <habib.virji@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/connectivity/common/inc/uarraylist.h
resource/csdk/connectivity/common/src/uarraylist.c
resource/csdk/connectivity/test/uarraylist_test.cpp