From 4fa50e035c6bebb0353e1aeb3239fe5f0500d150 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 28 Nov 2009 22:02:25 +0000 Subject: - Make a change to the area covered by threading locks in MCPStreamingConnection for a ~10-15% speedup in CPU-bound loops (eg data sets with lots of rows but little data) by reducing lock contention. (To be tested against #463) --- Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Frameworks/MCPKit') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index 4093b2a4..d675cebc 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -415,9 +415,6 @@ for (i = 0; i < mNumOfFields; i++) rowDataLength += fieldLengths[i]; - // Lock the data mutex - pthread_mutex_lock(&dataCreationLock); - // Initialise memory for the row and set a NULL pointer for the next item newRowStore = malloc(sizeOfLocalRowData); newRowStore->nextRow = NULL; @@ -438,7 +435,8 @@ // Set up and copy in the field lengths newRowStore->dataLengths = memcpy(malloc(sizeOfDataLengths), fieldLengths, sizeOfDataLengths); - // Lock the data free mutex + // Lock both mutexes + pthread_mutex_lock(&dataCreationLock); pthread_mutex_lock(&dataFreeLock); // Add the newly allocated row to end of the storage linked list -- cgit v1.2.3