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

It seems that Wikipedia refers to them as "Strings as records"[1], which I suppose fits quite well. I suppose that C strings could be considered "the most" cache friendly since it has only 1 byte overhead instead of however many bytes would be required for the length (probably 4 or 8 bytes on most modern systems). That said, I would be extremely surprised for this difference of a few bytes per string to have a measurable performance improvement in anything but an unrealistic microbenchmark involving many tiny strings.

1: https://en.wikipedia.org/wiki/String_(computer_science)#Stri...



0 terminated strings make sense for extremely tight memory cases, like 64Kb computers, and CPUs that don't cache memory. But they're a clear loser for 32 bit machines.




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

Search: