I performed a quick test and your assertion was false
First custom strlen as described by you
1 #include <string.h>
2
3
4 int main(){
5 int i=0;
6 int j=0;
7
8 char * my_string = "HHHHHHHHHHHHHHHHHHHHHH";
9 for(i=0; i< 10000000;i++) {
10 for(j=0; my_string[j]; j++);
11 }
12 }
13
14
The results where
0.60s real 0.60s user 0.00s system
Now using the strlen from strings.h
1 #include <string.h>
2
3
4 int main(){
5 int i=0;
6 int j=0;
7
8 char * my_string = "HHHHHHHHHHHHHHHHHHHHHH";
9 for(i=0; i< 10000000;i++) {
10 strlen(my_string);
11 }
12 }
I get
0.14s real 0.14s user 0.00s system
Which is 4 times faster
This is on i386 linux.
What platform are you on?