On Tuesday, 28 June 2016 at 09:18:34 UTC, qznc wrote:
Did you also compare to strlen from libc? I'd guess GNU libc
uses a lot more tricks like vector instructions.
I did test with the libc strlen, although the D libraries did not
have a strlen for dchar or wchar. I'm currently using this for
comparison, and playing around with shorter string lengths:
nothrow pure size_t strlen(const(char)* c) {
if (c is null )
return 0;
const(char)* c_save = c;
while (*c) {
c++;
}
return c - c_save;
}
I'm also trying some tests on a PA device where I have tools to
look at cache hits, misses, branches mispredicted. Similar C
code.