Reland "Only compile optimized if it is useful."

This reverts commit 35a1479ab434257e9db629fda5f4ca96bfbef3fc.

Reason for revert: Disable failing test on debuggable

Change-Id: Icd012ac9e3b37c1187adf5e915ba7c1ffc415805
11 files changed