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: 348
objective-c
|Performance
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