Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance hit incurred using NSMutableDictionary vs. NSMutableArray>

I am considering using an NSMutableDictionary in place of my current NSMutableArray. This is primarily for KVC/KVO reasons. The collection will undergo heavy mutation within the inner loop of my drawing method. Can I expect to incur a significant performance hit if I go ahead with this replacement?

Cheers, Doug

like image 781
dugla Avatar asked Dec 29 '22 20:12

dugla


1 Answers

The only way to be sure is to measure. None of us have enough knowledge about how NSMutableDictionary's and NSMutableArray's implementations work, so there's little point asking.

Granted, you could probably expect some hit since the dictionary has to do additional hashing that a simple array would not. Whether or not that is "significant" is hard to say.

Again, measure.

like image 105
kperryua Avatar answered Jan 01 '23 17:01

kperryua