Use KVO might slow down the startup speed

problem

In a first boot speed optimization, find a runLoop the beginning, one runLoop takes a long time. KVO found initialize a variable consumes 13ms years, which is unacceptable for a start-up speed.

Source code analysis

Look for the first time with the Instrument consuming and found call method_exchange, may be internal KVO implementation.
RunTime see the source code, this method will clear the list of all the cache method, time-consuming.

Guess you like

Origin www.cnblogs.com/huahuahu/p/shi-yong-kvo-ke-neng-hui-tuo-man-qi-dong-su-du.html