RestKit/RestKit — pull request #2069 by carllindberg (2014-10-29 08:18:52+00:00)
Title: Speed up RKMappingSourceObject KeyValue

The CFStringHasPrefix function did show up as a minor hotspot when profiling, and I tracked it back to RKMappingSourceObject. While hasPrefix is pretty fast, most calls it will not be one of the special keys, so a quick character check at the start can avoid all of the extra work.

I don't think it's possible to have an empty key used with valueForKey[Path], but if you want to be safe, I could add a check for [key length] == 0 as well.

It's not a huge improvement, but here are the numbers before:

(Device) Mapping 5000 students with relationship mapping: 39.762720
(Simulator) Mapping 5000 students with relationship mapping: 5.673784

After:

(Device) Mapping 5000 students with relationship mapping: 39.540743
(Simulator) Mapping 5000 students with relationship mapping: 5.572813