robertwijas / UISS

UIAppearance Stylesheets
MIT License
1.23k stars 80 forks source link

UISS greatly hinders app startup in iOS 9 #47

Closed BigSauce closed 9 years ago

BigSauce commented 9 years ago

Whereas I used iOS 8.4 previously, now I am using iOS 9 GM Seed, and UISS is slowing down app startup significantly (by about 10-20 seconds). It looks like the main bottleneck exists in the many [NSInvocation invoke] calls when setting up UISS.

robertwijas commented 9 years ago

Thanks for reporting that. I'll run some tests on my devices tomorrow.

robertwijas commented 9 years ago

@BigSauce could you please tell me:

  1. how many invocations are created by UISS?
  2. which SDK do you compile your app with?
  3. which device?

Thanks.

robertwijas commented 9 years ago

Looks like the code that creates NSInvocations is much slower on iOS9. For a workaround you can use UISS generated code.

BigSauce commented 9 years ago

Thanks for your quick response, @robertwijas.

The crash occurs on iPod Touch 5th Gen and iPad Mini (1). I speculate that this is because the hardware in the aforementioned older devices cannot compensate for the performance loss caused by NSInvocations as well as newer devices can, and so the app startup gets killed by iOS when it takes too long.

  1. I'll have to log how many invocations are created. I think it was a couple hundred, but I'll try to get a more precise figure to you tomorrow. EDIT: about 70
  2. pod 'UISS-iOS7', '~> 1.1.1-pdtgct.1', compiling with a target of iOS 7.1.
  3. iPod Touch 5th Gen and iPad Mini (1st gen).
BigSauce commented 9 years ago

What do you mean when you say "for a workaround you can use UISS generated code"?

robertwijas commented 9 years ago

In UISS console you can generate Obj-C code that calls UIAppearance proxies directly. You have to manually copy the code to your class and execute it when app is launching. This eliminates all the parsing and runtime juggling therefore it's as fast as possible.

BigSauce commented 9 years ago

I'll give this a try. Thanks for your prompt responses!

robertwijas commented 9 years ago

@BigSauce I published #48 which should improve the performance. Let me know if it's good enough for your iPad Mini 1st gen. Thanks!

BigSauce commented 9 years ago

@robertwijas That worked like a charm! App startup time improved by about 10-13 seconds.

Thanks for publishing that pull request. Can you merge it and publish the new version to the pod? Thanks again!

robertwijas commented 9 years ago

@BigSauce Done. Happy to help.