문제

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.

도움이 되었습니까?

해결책

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."

다른 팁

I would bet heavily that the Apple versions are heavily optimized. Why not just run Instruments and see if there is a performance issue?

For CFSet source code see: opensource.apple.com

static Boolean __CFSetEqual(CFTypeRef cf1, CFTypeRef cf2) {
return __CFBasicHashEqual((CFBasicHashRef)cf1, (CFBasicHashRef)cf2);
}

static CFHashCode __CFSetHash(CFTypeRef cf) {
return __CFBasicHashHash((CFBasicHashRef)cf);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top