faster strlen ?
Posted
by Jack
on Stack Overflow
See other posts from Stack Overflow
or by Jack
Published on 2009-11-21T07:08:32Z
Indexed on
2010/04/17
0:03 UTC
Read the original article
Hit count: 247
Typical strlen() traverse from first character till it finds \0.
This requires you to traverse each and every character.
In algorithm sense, its O(N).
Is there any faster way to do this where input is vaguely defined. Like: length would be less than 50, or length would be around 200 characters.
I thought of lookup blocks and all but didn't get any optimization.
© Stack Overflow or respective owner