only perform layout adjustments if necessary, and other layout performance improvements