Revision: 12290
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12290&view=rev
Author:   amaxwell
Date:     2008-01-05 15:13:26 -0800 (Sat, 05 Jan 2008)

Log Message:
-----------
Use getObjects:range: instead of subarrayWithRange, since we know the maximum
buffer size will fit on the stack easily.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconQueue.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconQueue.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconQueue.m     2008-01-05 
22:12:50 UTC (rev 12289)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconQueue.m     2008-01-05 
23:13:26 UTC (rev 12290)
@@ -55,6 +55,7 @@
 
 #define QUEUE_STARTUP 1
 #define QUEUE_STARTUP_COMPLETE 2
+#define TASK_BATCH_SIZE 5
 
 // I was creating the sharedInstance in +initialize in order to avoid 
@synchronized and thread safety issues.  However, that led to problems when the 
_runCacheThread triggered a second main thread message to +initialize, but the 
main thread was already blocked on _setupLock waiting for _runCacheThread to 
unlock.  Since +sharedQueue is only used from the main thread, I'll ignore 
singleton threading issues for now.
 + (FVIconQueue *)sharedQueue;
@@ -133,16 +134,22 @@
         [_iconsToRelease minusSet:[NSSet setWithArray:taskQueue]];
         [_taskLock unlock];
         
-        // batch these in intervals of 5, so the display updates incrementally 
instead of waiting for all the renders to finish
-        NSUInteger i = 0, iMax = [taskQueue count], length = MIN((iMax - i), 
(NSUInteger)5);
+        // batch these in intervals of TASK_BATCH_SIZE, so the display updates 
incrementally instead of waiting for all the renders to finish
+        NSUInteger i = 0, iMax = [taskQueue count], length = MIN((iMax - i), 
(NSUInteger)TASK_BATCH_SIZE);
         while (length) {
             NSAutoreleasePool *pool = [NSAutoreleasePool new];
             NSRange r = NSMakeRange(i, length);
-            NSArray *toRender = [taskQueue subarrayWithRange:r];
+            
+            id taskBatch[TASK_BATCH_SIZE];
+            [taskQueue getObjects:taskBatch range:r];
+            
+            NSArray *toRender = [[NSArray alloc] initWithObjects:taskBatch 
count:length];
             [toRender makeObjectsPerformSelector:@selector(renderOffscreen)];
             [target performSelectorOnMainThread:@selector(iconQueueUpdated:) 
withObject:toRender waitUntilDone:NO modes:modes];
+            [toRender release];
+            
             i = NSMaxRange(r);
-            length = MIN((iMax - i), (NSUInteger)5);
+            length = MIN((iMax - i), (NSUInteger)TASK_BATCH_SIZE);
             [pool release];
         }
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to