• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accelerated Obj-C Dispatch on Intel Only
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accelerated Obj-C Dispatch on Intel Only


  • Subject: Re: Accelerated Obj-C Dispatch on Intel Only
  • From: Ladd Van Tol <email@hidden>
  • Date: Mon, 27 Mar 2006 20:34:26 -0800


On Mar 27, 2006, at 4:08 PM, Eric Albert wrote:

We have measured a performance advantage on PowerPC, yes, but remember that this is only for objc_msgSend itself.  For most real Obj-C calls, there's more work in the method itself than in getting to the method in the first place.  That said, it'll make accessors and things like that faster, but few applications have objc_msgSend itself as a performance bottleneck.

OK, chalk it up to testing error. I re-ran my tests on a quiescent dual 2GHz G5, with the following code:

#import <Foundation/Foundation.h>

@interface TestClass : NSObject
{
int val;
}

- (int) val;

@end

@implementation TestClass

- (int) val
{
return val;
}

@end

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

TestClass *tc = [[TestClass alloc] init];
int i;


NSDate *startDate = [NSDate date];


for (i=0; i < 100000000; i++)
{
[tc val];
}

NSDate *endDate = [NSDate date];


NSLog(@"interval: %f", [endDate timeIntervalSinceDate:startDate]);


    [pool release];
    return 0;
}

Building with -Os, the best time (out of three runs) without accelerated dispatch was 1.73 seconds. With accelerated dispatch, 1.21 seconds. So, ignoring the looping and method body overhead, we get roughly 17 nanoseconds per call vs 12 nanoseconds per call, which is a pretty decent improvement, all things considered.

- Ladd
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Accelerated Obj-C Dispatch on Intel Only (From: Nick Nallick <email@hidden>)
 >Re: Accelerated Obj-C Dispatch on Intel Only (From: Eric Albert <email@hidden>)
 >Re: Accelerated Obj-C Dispatch on Intel Only (From: Ladd Van Tol <email@hidden>)
 >Re: Accelerated Obj-C Dispatch on Intel Only (From: Eric Albert <email@hidden>)

  • Prev by Date: Handling different library versions when deploying
  • Next by Date: Re: Help with Xcode i386 Link problems
  • Previous by thread: Re: Accelerated Obj-C Dispatch on Intel Only
  • Next by thread: Debugging on Intel
  • Index(es):
    • Date
    • Thread