Is there a design reason why beast static_string uses size_t for length?
Internally as a member, not talking about template argument. I would naively assume that performance overhead of having conversion from uint8_t/uint16_t(and uint32_t if you want to allow "insanely" large static_strings) to size_t is not big enough to justify "large"(in context of microoptimizations for space) overhead due to alignment and size requirements of size_t(on 64b machines). Recently I other context I complained that there is no way to nicely embed godbolt/source examples in here :), so here is a link with example: https://godbolt.org/z/Y4Y5zKj86 regards, Ivan
On Fri, Apr 15, 2022 at 6:43 PM Ivan Matek wrote:
Internally as a member, not talking about template argument.
Note that boost::static_string (Boost.StaticString) does not always use size_t:
https://github.com/boostorg/static_string/blob/develop/include/boost/static_...
// Find the smallest width integral type that can hold a value as
large as N (Glen Fernandes)
template
On Sat, Apr 16, 2022 at 3:32 AM Glen Fernandes
Note that boost::static_string (Boost.StaticString) does not always use size_t:
https://github.com/boostorg/static_string/blob/develop/include/boost/static_... Maybe boost::beast::static_string can become an alias to boost::static_string.
Weird. :) I would have expected them to be the same, I guess you did the fix I wanted but it was never backported(IIRC static_string was take out of beast to become standalone, but could be wrong). In any case my problem is solved, but if Vinnie sees this I would be interested to know if difference is intentional or not.
P.S.
If aliasing was not done due to lack of time I could work on it, but I
fear that largest part of work will be reviewing if changes did not break
anything, so I guess I will not be helping a lot/// but if there is an
issue to make this happen please let me know.
On Sat, Apr 16, 2022 at 12:40 PM Ivan Matek
On Sat, Apr 16, 2022 at 3:32 AM Glen Fernandes
wrote: Note that boost::static_string (Boost.StaticString) does not always use size_t:
https://github.com/boostorg/static_string/blob/develop/include/boost/static_... Maybe boost::beast::static_string can become an alias to boost::static_string.
Weird. :) I would have expected them to be the same, I guess you did the fix I wanted but it was never backported(IIRC static_string was take out of beast to become standalone, but could be wrong). In any case my problem is solved, but if Vinnie sees this I would be interested to know if difference is intentional or not.
On Sat, Apr 16, 2022 at 3:44 AM Ivan Matek via Boost
if there is an issue to make this happen please let me know.
participants (3)
-
Glen Fernandes
-
Ivan Matek
-
Vinnie Falco