minor performance tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38805 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2015-07-16 09:30:57 +00:00
parent 3b02814665
commit 5cbc47a238
3 changed files with 6 additions and 7 deletions

View file

@ -1971,12 +1971,15 @@ compare(id elem1, id elem2, void* context)
if (size > 0)
{
NSUInteger count = [self count];
GS_BEGINIDBUF(objects, count);
size += count*sizeof(void*);
[self getObjects: objects];
while (count-- > 0)
{
size += [[self objectAtIndex: count] sizeInBytesExcluding: exclude];
size += [objects[count] sizeInBytesExcluding: exclude];
}
GS_ENDIDBUF();
}
return size;
}

View file

@ -1241,9 +1241,8 @@ compareIt(id o1, id o2, void* context)
size += 3 * sizeof(void*) * count;
if (count > 0)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSEnumerator *enumerator = [self keyEnumerator];
NSObject *k;
NSEnumerator *enumerator = [self keyEnumerator];
NSObject *k;
while ((k = [enumerator nextObject]) != nil)
{
@ -1252,7 +1251,6 @@ compareIt(id o1, id o2, void* context)
size += [k sizeInBytesExcluding: exclude];
size += [o sizeInBytesExcluding: exclude];
}
[pool release];
}
}
return size;

View file

@ -1010,7 +1010,6 @@ static Class NSMutableSet_concrete_class;
size += 3 * sizeof(void*) * count;
if (count > 0)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSEnumerator *enumerator = [self objectEnumerator];
NSObject *o;
@ -1018,7 +1017,6 @@ static Class NSMutableSet_concrete_class;
{
size += [o sizeInBytesExcluding: exclude];
}
[pool release];
}
}
return size;