Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
mynameishere
on March 10, 2009
|
parent
|
context
|
favorite
| on:
Glibc's strlen implementation: Probably not what y...
It's faster if you just store the length in a separate memory location. This is very fast:
getLength() { return length; }
tptacek
on March 10, 2009
[–]
I'm worried nobody's going to mod this up because it doesn't talk about bit twiddling hacks or assembly cycle counts, but it is in fact that real answer to this problem. Don't use ASCIIZ when string processing is a bottleneck.
dchest
on March 11, 2009
|
parent
[–]
Probably because it's not a real answer to _this_ problem (counting the number of bytes in a null-terminated string)?
tptacek
on March 11, 2009
|
root
|
parent
[–]
Meh. Fair point.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: