Skip to content

Commit cc409e2

Browse files
Mark SalyzynPRJosh
authored andcommitted
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
1 parent cd581c6 commit cc409e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

liblog/log_is_loggable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int __android_log_level(const char *tag, int def)
9393
if (taglen) {
9494
uint32_t current_local_serial = current_global_serial;
9595

96-
if (!last_tag || strcmp(last_tag, tag)) {
96+
if (!last_tag || (last_tag[0] != tag[0]) || strcmp(last_tag + 1, tag + 1)) {
9797
/* invalidate log.tag.<tag> cache */
9898
for(i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
9999
tag_cache[i].pinfo = NULL;

0 commit comments

Comments
 (0)