0

All things equal, how does -[NSBundle loadNibNamed:owner:options:] compare to -[UITableViewCell initWithStyle:reuseIdentifier] in execution time when creating a custom UITableViewCell?

Assuming properties, layout (constraints) for the UITableViewCell and related to its view hierarchy are set under IB.

qnoid
  • 2,346
  • 2
  • 26
  • 45
  • Does loading from NIB slow your app down?.. – Sergey Kalinichenko Nov 13 '13 at 14:45
  • 1
    It's unlikely to be the performance bottleneck for you. What does Instruments say? – jrturton Nov 13 '13 at 14:49
  • @dasblinkenlight currently questioning the opposite. – qnoid Nov 13 '13 at 14:50
  • @jrturton trying to make sense of it as well http://stackoverflow.com/questions/19935278/is-running-time-cpu-usage-a-useful-metric-under-instruments-to-draw-any-con – qnoid Nov 13 '13 at 14:51
  • 1
    @qnoid You can't beat the code, because the iOS code that is reading the XIB for you will have to ultimately perform the same exact calls that your code performs, plus it would have to do the reading. However, reading an XML-like structure of XIB is very fast, so you aren't likely to see any time difference. – Sergey Kalinichenko Nov 13 '13 at 14:53
  • @dasblinkenlight no performance optimisations by the xib loader then? i.e. when asking cells for 20 index paths? – qnoid Nov 13 '13 at 14:56
  • 1
    BTW, instead of using [NSBundle loadNibNamed:owner:options:] to load a nib based cell, you should register the nib with registerNib:forCellReuseIdentifier:. I'm not sure whether this has any effect on performance, but it is the way Apple recommends now. – rdelmar Nov 13 '13 at 16:05

0 Answers0