< Previous PageNext Page > Hide TOC

Performance Considerations

Though key-value coding is efficient, it adds a level of indirection that is slightly slower than direct method invocations. You should use key-value coding only when you can benefit from the flexibility that it provides.

Additional optimization opportunities may be added in the future, but these will not change basic methods for key-value coding compliance.

Contents:

Overriding Key-Value Coding Methods
Optimizing To-Many Relationships


Overriding Key-Value Coding Methods

The default implementations of the key-value coding methods, such as valueForKey:, cache Objective-C runtime information to increase efficiency. You should take care when overriding these implementations to ensure that you do not adversely affect application performance.

Optimizing To-Many Relationships

To-many relationships that are implemented using the indexed form of the accessors will provide significant performance gains in many cases.

It’s recommended that you implement at least the minimum indexed accessors for you to-many collections. See “Collection Accessor Patterns for To-Many Properties” for further information.



< Previous PageNext Page > Hide TOC


© 2003, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.