Nick Klockenga

Auto Layout Performance

In the last few days I've been giving auto layout a honest try. Can't say I'm impressed. I did do most my coding/testing in Xcode 4.6.3, but I also tried out Xcode 5, and it is a little better than Xcode 4.6.3, but not much.

My first impression when adding auto layout constraints was painful. As I spent time adjusting to the learning curve of the interface builder tool, it only got a little easier to use. Prime example of the pain: shift a UI element one pixel over after adding a custom constraint; don't count on it still being there. In fact, Interface Builder will attempt to do you a favor by adding constraints you don't want. Using interface builder to add auto layout constraints sucks.

Second thing I noticed was a hit in performance when using auto layout. I was creating a few different table views with dynamic data that would make each table view cells to be different sizes. Calculating the table view height is painful enough, but an additional inefficiency during the creation of table view cells to calculate the height causes a noticeable delay when loading the view controller data source.

As soon as I noticed this I did a few google searches and found an interesting post dealing with the performance of auto layout. Here is an interesting graph pulled from the post:

auto layout graph

I'm not impressed with auto layout. I find little reason to use it. From here on out, I'll be laying out the fames of UI elements programmatically with out the help of auto layout.