minor performance tweak when handling lots of performs on other threads.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32020 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-09 10:10:04 +00:00
parent 5a597ddc01
commit fbf77be14b

View file

@ -1036,11 +1036,20 @@ static void *nsthreadLauncher(void* thread)
} }
#endif #endif
c = [performers count];
if (0 == c)
{
/* We deal with all available performers each time we fire, so
* it's likely that we will fire when we have no performers left.
* In that case we can skip the copying and emptying of the array.
*/
[lock unlock];
return;
}
toDo = [NSArray arrayWithArray: performers]; toDo = [NSArray arrayWithArray: performers];
[performers removeAllObjects]; [performers removeAllObjects];
[lock unlock]; [lock unlock];
c = [toDo count];
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
{ {
GSPerformHolder *h = [toDo objectAtIndex: i]; GSPerformHolder *h = [toDo objectAtIndex: i];