Daily iOS
UIKit

Auto Layout performance

On a screen made of complex cells with hundreds of constraints, the layout pass shows up as the bottleneck. Based on how the Auto Layout engine works, what drives the cost up?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

The engine (a Cassowary variant) rebuilds and re-solves the equation system on every constraint add or remove, and the number of constraints, inequalities, and priority combinations raise the solving cost. Changing only constants needs just a re-solve and is comparatively cheap.

Share a question