Optimize resetting of state when detaching components (#10899, #11284)

This has a significant impact on some older browsers, especially IE8.
This change also adds hierarchy update profiling statements to
help find hotspots.

Change-Id: Id7025776f8606794ba1d7aef99e2c37832b0c6bb
Optimize large Vertical/HorizontalLayout client side (#12420, #10899)

Spacing is now only handled at the beginning and end of hierarchy
updates, not for every component separately.
Some more profiling data on potential hotspots is also generated when
Profiler is used.

Change-Id: Ief1138dfd9161b683f69513e3458b8174de592bc