|
|
|
|
|
by gpderetta
2329 days ago
|
|
You shouldn't need a branch though. The size would always be the last element of the buffer. It doubles as the null terminator if the size is exactly 23. The only additional operation is adding the static offset to the stored value to get the actual size. It is probably just a small win and not everybody wanted to pay for the extra complexity (SSO is already fairly complex). Re your suggestion on large SSO, years ago, when doing document clustering, using large fixed size strings (64 chars if I remember correctly, longer strings were just truncated) was a huge win for me (even coping them around wasn't an issue). Not sure if it is appropriate for a general purpose string though. edit: never mind, I see what you mean about having to check the size. |
|
[0]: https://github.com/facebook/folly/blob/master/folly/FBString...
[1]: https://godbolt.org/z/U-LvGm