Is literal creation of an NSMutableDictionary less efficient than the class helper method?

前端 未结 1 593
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-20 13:42

Is it appreciably more efficient to create an NSMutableDictionary using a constructor

[NSMutableDictionary dictionaryWithObjectsAndKeys:@\"objec         


        
相关标签:
1条回答
  • 2020-12-20 14:10

    As Jeremy said; measure, measure, measure.... then optimize if you have a real problem.

    Without looking at the source, I can think of possible reasons why either might be faster and that answer may change depending on # of entries.

    The real question, though, is why do you have an app architecture where it matters? It is quite rare to have an application that is creating so many mutable dictionaries (or dictionaries so large) that it is a performance issue.

    0 讨论(0)
提交回复
热议问题