Optimized ComputeBounds.

ComputeBounds was unnecessarily slow. Improved.

Change-Id: Id3453e7362bb0f18f362be2139dc3c90f80b3dff
Merge topic 'compute-bounds-performance-improvement' into master

31a47702 Optimized ComputeBounds.