mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Make the class method invocation benchmark more fair by using 10 different
classes; added bench for NSClassFromString git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9678 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
eb52312f73
commit
af84761daf
1 changed files with 33 additions and 2 deletions
|
@ -66,12 +66,42 @@ bench_object()
|
|||
PRINT_TIMER("Baseline: 10 method calls");
|
||||
|
||||
START_TIMER;
|
||||
for (i = 0; i < MAX_COUNT*10; i++)
|
||||
for (i = 0; i < MAX_COUNT; i++)
|
||||
{
|
||||
id i = [NSObject class];
|
||||
/* Ten class methods with the more common class names */
|
||||
id i;
|
||||
i = [NSObject class];
|
||||
i = [NSString class];
|
||||
i = [NSDictionary class];
|
||||
i = [NSArray class];
|
||||
i = [NSData class];
|
||||
i = [NSUserDefaults class];
|
||||
i = [NSMutableArray class];
|
||||
i = [NSFileManager class];
|
||||
i = [NSMutableString class];
|
||||
i = [NSMutableDictionary class];
|
||||
}
|
||||
END_TIMER;
|
||||
PRINT_TIMER("Class: 10 class method calls");
|
||||
|
||||
START_TIMER;
|
||||
for (i = 0; i < MAX_COUNT; i++)
|
||||
{
|
||||
/* Corresponding look ups */
|
||||
id i;
|
||||
i = NSClassFromString (@"NSObject");
|
||||
i = NSClassFromString (@"NSString");
|
||||
i = NSClassFromString (@"NSDictionary");
|
||||
i = NSClassFromString (@"NSArray");
|
||||
i = NSClassFromString (@"NSData");
|
||||
i = NSClassFromString (@"NSUserDefaults");
|
||||
i = NSClassFromString (@"NSMutableArray");
|
||||
i = NSClassFromString (@"NSFileManager");
|
||||
i = NSClassFromString (@"NSMutableString");
|
||||
i = NSClassFromString (@"NSMutableDictionary");
|
||||
}
|
||||
END_TIMER;
|
||||
PRINT_TIMER("Function: 10 NSClassFromStr");
|
||||
|
||||
START_TIMER;
|
||||
myZone = NSCreateZone(2048, 2048, 1);
|
||||
|
@ -189,6 +219,7 @@ bench_object()
|
|||
PRINT_TIMER("NSLock: 10 lock/unlock");
|
||||
[obj release];
|
||||
|
||||
|
||||
AUTO_END;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue