On Sat, Oct 25, 2008 at 20:13, Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx> wrote: > Kay Sievers wrote: >> On Sat, Oct 25, 2008 at 16:51, Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx> wrote: >> >>> C initializers include an implicit "others => 0" (Ada syntax). >>> Initializing a char array to "" is equivalent to a memset() >>> call - which is exactly what it gets compiled to. >>> >>> Fixing this one callsite reduced memset() _user_ cpu cycles >>> from 2-4% to 0.05% on the EeePC. >>> >>> There are other occurences, but the fix isn't that pretty >>> so I left them alone. >>> - char value[UTIL_NAME_SIZE] = ""; >>> + char value[UTIL_NAME_SIZE]; >>> size_t len; >>> >>> util_strlcpy(attr, key_name, sizeof(attr)); >>> + util_strlcpy(value, "", sizeof(value)); >> >> Wouldn't value[0] = '\0' be even faster? :) > > Heh. That would probably be clearer as well. There's no big > difference, use whatever you prefer. I applied your patch, and changed all the other occurrences too. The match_attr() is still pretty high in the profile, so we do one of the srlcpy() now only if we need to. Thanks, Kay -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html