What's the performance penalty of using isKindOfClass in Objective C?

Posted by durcicko on Stack Overflow See other posts from Stack Overflow or by durcicko
Published on 2010-03-28T22:03:32Z Indexed on 2010/03/29 8:43 UTC
Read the original article Hit count: 326

Filed under:
|

I'm considering introducing:

if ([myInstance isKindOfClass:[SomeClass class]]) { do something...}

into a piece of code that gets called pretty often. Will I introduce a significant performance penalty? In Objective C, is there a quicker way of assessing whether a given object instance is of certain class type? For example, is the following quicker? (I realize the test is somewhat different)

if (myInstance.class == [SomeClass class]) { do something else...}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about Performance