| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On 21 Oct 2004, at 21:05, Evan Schoenberg wrote:
On Oct 21, 2004, at 10:35 AM, Nicko van Someren wrote:
It is quite common when writing programs for Cocoa that a data structure needs to be mutable while it is being filled but after that it would be useful for it become immutable in order to take advantage of the efficiencies that affords once the object has been set up.
This has been a wonder of mine for a long time in Cocoa.. do you have information on how precisely the immutable objects are more efficient? I've heard the claim before but never seen hard data either confirming or denying it.
If you make immutable copies of immutable NSString, NSDate, NSArray or NSDictionary objects (to pick a few important examples) you simply get the same object with the reference count incremented. This saves some data copying for simple objects and by the time you get to complex objects like dictionaries the cost of copying can get pretty high.
| References: | |
| >Copy and release (From: Nicko van Someren <email@hidden>) | |
| >Re: Copy and release (From: Evan Schoenberg <email@hidden>) | |
| >Re: Copy and release (From: Nicko van Someren <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.