Search code examples
objective-cnsmutableset

NSMutableSet union set performance/implementation


I'm wondering how is union set implemented in an NSMutableSet instance. I have two large sets that needs to be unionized frequently and I'm wondering if I should implement my own way of unionizing two sets or if Apple's way is fast enough.


Solution

  • The performance of NSMutableSet depends greatly on the implementation of -hash and -isEqual by the objects in the set. I would not think you'd get a performance boost implementing it yourself. However, you could try it and then profile your code to see if it's "too slow."