liblog: optimize code hotspot

strcmp was 1/10 #2 behind find_property in __android_log_level(),
now virtually eliminated from performance profile.

Bug: 23685592
Change-Id: I3978886193af77e489c6d1728d6a26b7f53f8f2f
This commit is contained in:
Mark Salyzyn 2015-10-02 10:00:38 -07:00
parent b955f476d3
commit 16e1c9dfdc
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ static int __android_log_level(const char *tag, int def)
if (taglen) {
uint32_t current_local_serial = current_global_serial;
if (!last_tag || strcmp(last_tag, tag)) {
if (!last_tag || (last_tag[0] != tag[0]) || strcmp(last_tag + 1, tag + 1)) {
/* invalidate log.tag.<tag> cache */
for(i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
tag_cache[i].pinfo = NULL;