Efficiency hacks - avoiding objc messaging overheads.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3032 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-10-06 15:11:27 +00:00
parent 26e47289b1
commit 39b8ff1baf
7 changed files with 386 additions and 88 deletions

View file

@ -37,6 +37,11 @@
#include <Foundation/NSZone.h>
#include <limits.h>
#include <gnustep/base/fast.x>
fastCls _fastCls; /* Structure to cache classes. */
fastImp _fastImp; /* Structure to cache methods. */
/*
* Reference count and memory management
@ -309,6 +314,26 @@ static BOOL double_release_check_enabled = NO;
retain_counts_gate = objc_mutex_allocate ();
#endif
autorelease_class = [NSAutoreleasePool class];
/*
* Cache some classes for quick access later.
*/
_fastCls._NSString = [NSString class];
_fastCls._NSGString = [NSGString class];
_fastCls._NSGMutableString = [NSGMutableString class];
_fastCls._NSGCString = [NSGCString class];
_fastCls._NSGMutableCString = [NSGMutableCString class];
_fastCls._NXConstantString = [NXConstantString class];
/*
* Cache some method implementations for quick access later.
*/
_fastImp._NSString_hash = (unsigned (*)())[_fastCls._NSString
instanceMethodForSelector: @selector(hash)];
_fastImp._NSGString_hash = (unsigned (*)())[_fastCls._NSGString
instanceMethodForSelector: @selector(hash)];
_fastImp._NSGString_isEqual_ = (BOOL (*)())[_fastCls._NSGString
instanceMethodForSelector: @selector(isEqual:)];
_fastImp._NSGCString_isEqual_ = (BOOL (*)())[_fastCls._NSGCString
instanceMethodForSelector: @selector(isEqual:)];
}
return;
}