Split the setting the height of elements into a separate loop and detached the elements to reduce the number of reflows and repaints.