If you wrap an NSMutableSet , then the call to containsObject: not needed, since the set ( by definition ) does not contain duplicates. Thus, if you try to insert an object that is already in the set, nothing will happen.
As far as performance is concerned, don't worry about it if you don't rate it as a problem. I would be very very surprised if I could, because the set (at least the smart implementation of the set) has O (1) search time (average case). I guarantee that NSSet and friends are smart implementations. :)
From what I have gathered about the implementation of NSSet , it calls -hash for objects as a way to group them into cells if you use containsObject: or addObject: If you use containsObjectIdenticalTo: it will still use -hash to narrow down the search process, and then (essentially) do pointer comparisons to find an identical object.
source share