Performance enhancements.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3110 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-10-25 07:56:22 +00:00
parent 50fb4a14d0
commit 20e7c3663b
4 changed files with 35 additions and 1 deletions

View file

@ -1,3 +1,13 @@
Sun Oct 25 08:00:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
src/NSObject.m: Cache implementation for adding object to autorelease
pool to avoid objc runtime messaging overhead.
src/NSAutoreleasePool.m: Cache implementation for adding object to
src/NSAutoreleasePool.m: Cache implementation for adding object to
autorelease pool to avoid objc runtime messaging overhead.
src/NSGCString.m: Implemented ([+allocWithZone:])
src/NSGString.m: Implemented ([+allocWithZone:])
Sat Oct 24 11:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
src/NSArchiver.m: New implementation

View file

@ -40,6 +40,11 @@
@implementation NSGCString
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject (self, 0, z);
}
- (void)dealloc
{
if (_zone) {
@ -479,6 +484,11 @@
@implementation NSGMutableCString
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject (self, 0, z);
}
+ (void) initialize
{
static int done = 0;

View file

@ -48,6 +48,11 @@
@implementation NSGString
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject (self, 0, z);
}
- (void)dealloc
{
if (_zone)
@ -319,6 +324,11 @@
// @protocol NSMutableString <NSString>
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject (self, 0, z);
}
+ (void) initialize
{
static int done = 0;

View file

@ -346,6 +346,8 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
need mutex protection, since it is simply a pointer that gets read
and set. */
static id autorelease_class = nil;
static SEL autorelease_sel = @selector(addObject:);
static IMP autorelease_imp = 0;
/* When this is `YES', every call to release/autorelease, checks to
make sure isn't being set up to release itself too many times.
@ -367,6 +369,7 @@ static BOOL double_release_check_enabled = NO;
retain_counts_gate = objc_mutex_allocate ();
#endif
autorelease_class = [NSAutoreleasePool class];
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
_fastBuildCache();
}
return;
@ -594,7 +597,7 @@ static BOOL double_release_check_enabled = NO;
@"%d release(s) versus %d retain(s)", release_count, retain_count];
}
[autorelease_class addObject:self];
(*autorelease_imp)(autorelease_class, autorelease_sel, self);
return self;
}
@ -921,6 +924,7 @@ static BOOL double_release_check_enabled = NO;
+ (void) setAutoreleaseClass: (Class)aClass
{
autorelease_class = aClass;
autorelease_imp = [self instanceMethodForSelector: autorelease_sel];
}
+ (Class) autoreleaseClass