Performance difference between dot notation versus method call in Objective-C

前端 未结 5 2057
执笔经年
执笔经年 2020-12-15 09:21

You can use a standard dot notation or a method call in Objective-C to access a property of an object in Objective-C.

myObject.property = YES;
5条回答
  •  借酒劲吻你
    2020-12-15 09:46

    Also read this blog post on Cocoa with Love:

    http://cocoawithlove.com/2008/06/speed-test-nsmanagedobject-objc-20.html

    There the author compares the speed of custom accessor and dot notations for NSManagedObject, and finds no difference. However, KVC access (setValue:forKey:) appears to be about twice as slow.

提交回复
热议问题