From ab9b7d9dad3dcd3a2675d33684729637e5509d42 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 17 Jan 2010 16:24:13 +0000 Subject: Add a new SPDataStorage class, and use it in TableContent and CustomQuery: - SPDataStorage is a class designed for a 2D array of fixed-width data storage, replacing the current method of nested NSMutableArrays. NSFastEnumerator compatible. - Overall memory overhead for table storage in memory reduced by 1.2-1.4x - this almost gains back the large memory jump seen for 64 bit - Some operations (adding data, retrieving a single cell's data) are faster than nested NSMutableArrays; some operations (requesting a row as an NSArray) are slightly slower as the data needs to be converted, but overall result is a slight speed gain. (- Could be used in future to store SQL results in C datatypes, avoiding very high NSObject overhead for numbers and short strings) --- Source/TableContent.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/TableContent.h') diff --git a/Source/TableContent.h b/Source/TableContent.h index c467b865..1b9e4af6 100644 --- a/Source/TableContent.h +++ b/Source/TableContent.h @@ -28,7 +28,7 @@ #import #import -@class CMCopyTable, SPTextAndLinkCell, SPHistoryController, SPTableInfo; +@class CMCopyTable, SPTextAndLinkCell, SPHistoryController, SPTableInfo, SPDataStorage; @interface TableContent : NSObject { @@ -72,7 +72,8 @@ pthread_mutex_t tableValuesLock; NSString *selectedTable, *usedQuery; - NSMutableArray *tableValues, *dataColumns, *keys, *oldRow; + SPDataStorage *tableValues; + NSMutableArray *dataColumns, *keys, *oldRow; NSUInteger tableRowsCount, previousTableRowsCount; NSString *compareType; NSNumber *sortCol; -- cgit v1.2.3