Because string comparison is usually alphabetic. If a string is longer/shorter it says nothing about its ordering. Even if the lengths are equal, you still need to memcmp them to verify hey are indeed equal. The length doesn't actually get you new information in this context.
I'm assuming encoding and utf-8 normalization and other similar things are not in scope when answering this.
I'm assuming encoding and utf-8 normalization and other similar things are not in scope when answering this.