Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's faster if you just store the length in a separate memory location. This is very fast:

  getLength()
  {
    return length;
  }


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.


Probably because it's not a real answer to _this_ problem (counting the number of bytes in a null-terminated string)?


Meh. Fair point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: