ibireme / YYCache

High performance cache framework for iOS.
MIT License
2.38k stars 513 forks source link

请问为什么要用CFMutableDictionaryRef而不用NSMutableDictionary? #112

Closed xuzhongping closed 2 years ago

xuzhongping commented 7 years ago

你好前辈,我简单测试了一下发现NSMutableDictionary的性能是优于CFMutableDictionaryRef,而且线程安全你已经在YYMemoryCache中手动设置了,所以在这两者之间你为何会选择CFMutableDictionaryRef?求解?

xuzhongping commented 7 years ago

除了防止非字符串的key没遵守NSCopy协议,还有别的因素吗??

li6185377 commented 6 years ago

性能

xuzhongping commented 6 years ago

貌似主要原因还是因为防止key没遵守NSCopy协议,性能的区别并不是很大,甚至有时候还不如NSMutableDictionary