Disable slow sanity check when not in debug mode (#12463)

Change-Id: I98d0a3254a92bce728d56a591914e727f5ef3aa8