[res] Optimize locale comparison and alias search

1. Locale comparison doesn't need to happen if the locales
   aren't set at all, and an early check skips the function
   call overhead

2. Staging resource aliases only exist for Framework resources,
   and are constrained to a pretty short range. Given that
   the binary search in STL doesn't check for the value to be
   inside the array, most of the alias searches end up hitting
   the worst case with the full log2(n) of halvings before they
   fail to find it. An early check speeds up the resource
   lookups by a whopping 10-15%.

Bug: 345562237
Test: build, boot, atest + performance tests
Change-Id: Ifd2c12c74df4b21a81609102291e6aabe38c2670
1 file changed