Optimizing some slow calls on the main thread

Change-Id: I4eed5f7e5bf1316556d6985a610918fc709a7471
8 files changed