Severe performance issue with many KVO observers on iOS 9

Originator:steipete
Number:rdar://22758506 Date Originated:18-Sep-2015 06:04 PM
Status:Open Resolved:
Product:iOS SDK Product Version:9.0
Classification:Performance Reproducible:Always
 
This is a duplicate of rdar://22718754

Summary:
There are severe performance issues with adding and removing KVO observers on iOS 9. This can be reproduced when many different observers are added to a single receiver with distinct "context" values.

Steps to Reproduce:
Using attached example project:
1. Run project on iOS 8.
2. Run project on iOS 9.

(Use a single receiver that observes distinct objects using distinct "context" values. Repeat in a loop.)

Expected Results:
Benchmarks are similar between iOS 8 et iOS 9

Actual Results:
The time needed to add an observer grows constantly as observers are added.

With the attached project on an iPad 2:
- the last operation on iOS 8 takes 1.3 ms.
- the last operation on iOS 9 takes 292.5 ms.

Version:
iOS 9.0 [13A340] and iOS 9.1 [13B5110e]

Notes:
Example project can also be found here:
https://github.com/lpios/SlowKVOPerformance

See also this issue on GitHub:
https://github.com/facebook/KVOController/issues/72

Configuration:
Reproducible on any device

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!