RestKit/RestKit — pull request #2083 by carllindberg (2014-11-10 18:22:10+00:00)
Title: Small speedups in RKPropertyInspector

When doing investigations on #2065, the RKPropertyInspector method classForPropertyNamed:ofClass:isPrimitive: is (unsurprisingly) one of the larger hotspots left, since it gets called extremely often. It has been optimized pretty well already, so not much can be done that I can see, with one exception. A simple accessor method call is faster than an NSDictionary -objectForKey:, and the property information is stored with immutable NSDictionaries with known keys, so we can easily convert that to a real object, and eliminate one -objectForKey: call. That has a small but measurable effect.

I deprecated the previous key constants, though implemented methods such that if the new object is used as a dictionary it should continue to work in most cases. Not sure if you would prefer that approach or to just remove the existing constants.

I also sped up the rk_classForPropertyAtKeyPath: method similar to a change in another pull request, though that does not get called during my test case.

Timings before:
(Device) Mapping 5000 students with relationship mapping: 16.064542
(Simulator) Mapping 5000 students with relationship mapping: 2.274153

and after:
(Device) Mapping 5000 students with relationship mapping: 15.740304
(Simulator) Mapping 5000 students with relationship mapping: 2.230252