C: Why some string.h algorithms work slower than simple hand-made ones?
Posted
by MInner
on Stack Overflow
See other posts from Stack Overflow
or by MInner
Published on 2010-03-24T21:54:38Z
Indexed on
2010/03/24
22:03 UTC
Read the original article
Hit count: 282
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.
© Stack Overflow or respective owner