mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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:
parent
37b25563c6
commit
1b0bf3c664
7 changed files with 386 additions and 88 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue