C: Why some string.h algorithms work slower than simple hand-made ones?
- by MInner
For example, strlen() takes about 3*O(n). Why 3? I've wrote a really simple strlen-like function - it works much faster.
int string_len(char s[],int &l)
{
for(l=0;s[l];l++);
return l;
}
Well, some of my friends says, nearly all of string.h algorithms are slower than they should be.