Re:Rapidstring: Maybe the fastest string library ever
by JeromeBonnet on Wednesday August 01, 2018 @05:39AM
(#17660969)
It is a trade off. I see the length limit is 23 for SSO-23, but it could have been arbitrarily larger. What is the basis for the determination of those magic length limit targets?
Re:Rapidstring: Maybe the fastest string library ever
by masklinn on Wednesday August 01, 2018 @06:03AM
(#17661104)
The size of the pre-existing non-SSO string. SSO-23 is predicated on a stack layout of (pointer, capacity, size) (as in Clang). That's why SSO-23 applied to the pre-existing MSVC or GCC std::string yields 31 on-stack bytes, they have a stack size of 32 bytes.
If you do that you have to spill your SSO to the heap way earlier, rapidstring would have 15 bytes SSO instead of the current 31, and std::string would be limited to 7 compared to the current 23~31.