RestKit/RestKit — pull request #2066 by carllindberg (2014-10-29 03:03:43+00:00)
Title: Change RKObjectMapping's propertyMappings accessor method to simply retu...

Change RKObjectMapping's propertyMappings accessor method to simply return the internal array, rather than making a full copy on every access.

Several methods of RKObjectMapping itself call it like a regular accessor (to get the count, for example) and it gets called a tremendous number of times during mapping operations. This saves a lot of memory during those operations, plus alloc/dealloc/retain/release/autorelease overhead.

This did show up during analysis of the performance issues noted at https://github.com/RestKit/RestKit/issues/2065 . When using the test application posted at https://github.com/rtimpone/restkit_relationship_mapping_benchmarking , I get the following timings on my device (an iPad 3) and iOS simulator (timings in seconds, and after the RKValueTransformer cache was added):

(Device) Mapping 5000 students with relationship mapping: 43.592469
(Simulator) Mapping 5000 students with relationship mapping: 6.214763

After applying this fix, the results are now more like:

(Device) Mapping 5000 students with relationship mapping: 41.293718
(Simulator) Mapping 5000 students with relationship mapping: 5.952791