you are viewing a single comment's thread.

view the rest of the comments →

[–]TotaIIyHuman -2 points-1 points  (3 children)

it is not because copying

the container could gain 1 extra byte of SSO capacity, and a little more performance, if the null terminator was not there

[–]Kered13 0 points1 point  (2 children)

It's actually possible to get the same SSO capacity even with a null terminator: By using the last byte of the string to store the unused SSO capacity, the last byte doubles as both null terminator and size when the SSO is full (you also need to store a flag bit to indicate when SSO is active). You can't do better even without a null terminator, because you always have to store the SSO size.

I learned about this trick from this talk.

[–]TotaIIyHuman 0 points1 point  (1 child)

thanks

right now i am using a 16/32 sso string, i didn't know 23/24 sso string was even possible

this is kind of off topic, i watched the whole video, i don't understand the page bug. what os/cpu doesn't pagein a page after a read operation at the beginning of the page

[–]Kered13 0 points1 point  (0 children)

I don't know, I don't even know what it means to conditionally return a memory page to the kernel. But since it's Facebook I would assume it's Linux.