You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that std::string objects are not constructed in the arena memory but only marked as owned by the arena.
I understand why the current design does not allow to put long strings completely into the arena, but why is the std::string object itself not in the arena?
This way, string values that fit into the short string optimization buffer would not cause any heap allocation outside the arena and long strings would only require one heap allocation instead of two.
The method ArenaStringPtr::CreateInstance currently looks this way:
@acozzette Yes, until now I have not tried this change by my self. I have just noticed that my application was doing more small allocations than expected.
I will have a closer look at it the next days and create a patch.
Hi!
I have noticed that std::string objects are not constructed in the arena memory but only marked as owned by the arena.
I understand why the current design does not allow to put long strings completely into the arena, but why is the std::string object itself not in the arena?
This way, string values that fit into the short string optimization buffer would not cause any heap allocation outside the arena and long strings would only require one heap allocation instead of two.
The method
ArenaStringPtr::CreateInstance
currently looks this way:but I would have expected an implementation that looks something like this:
Thank you!
P.S.: Support for std::string_view (
[ctype = STRING_VIEW]
) as a replacement of your internal StringPiece would be even better :-)The text was updated successfully, but these errors were encountered: