<format> locale fixes#1862
Conversation
|
FYI @vitaut |
StephanTLavavej
left a comment
There was a problem hiding this comment.
Thanks! I have a few comments that I'll push changes for.
CaseyCarter
left a comment
There was a problem hiding this comment.
Approving as a clear improvement, but I think I'd like to investigate storing lazily-constructed locale and _Cvtvec in basic_format_context so we can guarantee at-most-one construction of each per format call.
I don't think this effects the cvtvec at all, since that's populated once in the parsing functions, no matter how many format arguments you use. |
I observed that Besides, |
Yeah, I want to investigate faster options, however it's not ABI and users have an escape hatch with |
|
Thanks for this combination bugfix/perf improvement! 🪲 🚀 😸 |
std::locale::localeno longer shows up in the profile after the change.Note: there's an alternate, slightly more clever approach, where _Default_arg_formatter and basic_format_context store uninitialized storage for a locale, and it's again initialized on demand. The advantage of this is that in format strings with multiple locale sensitive format-specs the locale would only have to be constructed once, it also might be possible to adopt this method without breaking ABI (although it would be scary). The disadvantage here is the code gets more confusing and it will be much harder to break the dependency on if we want to do that in the future.