On 2025/1/14 07:46, Rob Herring wrote:
quoted
i understand your concern about performance.
what about below solution ?
See 72921427d46b ("string.h: Add str_has_prefix() helper function").
Though we already had strstarts(), but that lacks __always_inline which
seems is important for eliminating the strlen(). Also, since that
commit, clang has become more common and need to make sure the same
optimization happens on it.
than you Rob for sharing with these useful info.
i believe your proposal is feasible to improve strstarts() performance
to achieve performance level of
strncmp(str, "const", sizeof("const") - 1).
this is a common issue and i would like to start a new thread to discuss
this.