user1467267
user1467267

Reputation:

Custom segued view with lots of elements slow

When I trigger my CatalogController like so on an iPad 3 (in the Simulator it takes under a second, but that's not relevant):

- (IBAction)goToCatalog:(id)sender {
    NSLog(@"goToCatalogPre");
    [self presentViewController:[[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"CatalogController"] animated:YES completion:nil];
    NSLog(@"goToCatalogPost");
}

I get this result:

2016-03-23 11:27:07.245 Fashion App[592:78778] goToCatalogPre
2016-03-23 11:27:13.571 Fashion App[592:78778] goToCatalogPost

So that's a rough 6.25 seconds. I tested the viewDidLoad from start to end and literally takes a few nanoseconds. Nothing else triggers besides that call.

I have these delegates attached to my ViewController:

@interface CatalogController : CoreController <UICollectionViewDelegate, UICollectionViewDataSource, UISearchBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>

CoreController only does one variable tracking so there's not slowness there.

Anyone have any experience what might cause this anomaly? Honestly I could deconstruct all the elements to trace it back but I was wondering if anyone might have encountered this before and what might cause it or where other I can trace it than in the viewDidLoad call.

Here are the elements in my storyboard on this view:

enter image description here

enter image description here

Upvotes: 0

Views: 48

Answers (1)

user1467267
user1467267

Reputation:

I used the Time Profiler and it literally happens under the hood. At some point it hits a UIButton (69% of the total run time), then deeper down the line it TBaseFont:CopyLocalizedName(__CFString const*) and from there it splits into 33% and 22% (and some remainder) into some localized cache and TBaseFont::CopyNativeFont() const. Guess I'll have to go about all buttons and see which one might cause this.

After some tracing I found (through this answer: Xib taking long time (>1s) to load. UIFont cache seems to blame) that it was a old missing font fault. It tries to load an old variation of Lucida Grande and it somehow seems to stall the cache making it freak out. Correcting the font to become System again fixed it. The load time instantly is just a few milliseconds.

Upvotes: 2

Related Questions