mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-16 10:50:56 +00:00
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:
parent
e6d36d8e5c
commit
bbabd52501
4 changed files with 35 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -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>
|
Sat Oct 24 11:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
src/NSArchiver.m: New implementation
|
src/NSArchiver.m: New implementation
|
||||||
|
|
|
@ -40,6 +40,11 @@
|
||||||
|
|
||||||
@implementation NSGCString
|
@implementation NSGCString
|
||||||
|
|
||||||
|
+ allocWithZone: (NSZone*)z
|
||||||
|
{
|
||||||
|
return NSAllocateObject (self, 0, z);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if (_zone) {
|
if (_zone) {
|
||||||
|
@ -479,6 +484,11 @@
|
||||||
|
|
||||||
@implementation NSGMutableCString
|
@implementation NSGMutableCString
|
||||||
|
|
||||||
|
+ allocWithZone: (NSZone*)z
|
||||||
|
{
|
||||||
|
return NSAllocateObject (self, 0, z);
|
||||||
|
}
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
|
|
|
@ -48,6 +48,11 @@
|
||||||
|
|
||||||
@implementation NSGString
|
@implementation NSGString
|
||||||
|
|
||||||
|
+ allocWithZone: (NSZone*)z
|
||||||
|
{
|
||||||
|
return NSAllocateObject (self, 0, z);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if (_zone)
|
if (_zone)
|
||||||
|
@ -319,6 +324,11 @@
|
||||||
|
|
||||||
// @protocol NSMutableString <NSString>
|
// @protocol NSMutableString <NSString>
|
||||||
|
|
||||||
|
+ allocWithZone: (NSZone*)z
|
||||||
|
{
|
||||||
|
return NSAllocateObject (self, 0, z);
|
||||||
|
}
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
|
|
|
@ -346,6 +346,8 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
|
||||||
need mutex protection, since it is simply a pointer that gets read
|
need mutex protection, since it is simply a pointer that gets read
|
||||||
and set. */
|
and set. */
|
||||||
static id autorelease_class = nil;
|
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
|
/* When this is `YES', every call to release/autorelease, checks to
|
||||||
make sure isn't being set up to release itself too many times.
|
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 ();
|
retain_counts_gate = objc_mutex_allocate ();
|
||||||
#endif
|
#endif
|
||||||
autorelease_class = [NSAutoreleasePool class];
|
autorelease_class = [NSAutoreleasePool class];
|
||||||
|
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
||||||
_fastBuildCache();
|
_fastBuildCache();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -594,7 +597,7 @@ static BOOL double_release_check_enabled = NO;
|
||||||
@"%d release(s) versus %d retain(s)", release_count, retain_count];
|
@"%d release(s) versus %d retain(s)", release_count, retain_count];
|
||||||
}
|
}
|
||||||
|
|
||||||
[autorelease_class addObject:self];
|
(*autorelease_imp)(autorelease_class, autorelease_sel, self);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,6 +924,7 @@ static BOOL double_release_check_enabled = NO;
|
||||||
+ (void) setAutoreleaseClass: (Class)aClass
|
+ (void) setAutoreleaseClass: (Class)aClass
|
||||||
{
|
{
|
||||||
autorelease_class = aClass;
|
autorelease_class = aClass;
|
||||||
|
autorelease_imp = [self instanceMethodForSelector: autorelease_sel];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (Class) autoreleaseClass
|
+ (Class) autoreleaseClass
|
||||||
|
|
Loading…
Reference in a new issue