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.
Overriding Key-Value Coding Methods
Optimizing To-Many Relationships
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.
To-many relationships that are implemented using the indexed form of the accessors -countOf<Key> and -objectIn<Key>AtIndex: may benefit from implementing the optional -get<Key>:range: method. This method should return an array containing the objects in the specified range.
Similarly, if the to-many relationship contents are mutable, you can implement -replaceObjectIn<Key>AtIndex:withObject:. The implementation of this method replaces the object at the specified index with the new object.
Last updated: 2007-06-06