C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Should std::to_string be deprecated?

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Wed, 4 Oct 2023 16:45:45 +0300
On 10/4/23 16:44, Marcin Jaczewski wrote:
> śr., 4 paź 2023 o 15:42 Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden]> napisał(a):
>>
>> On 10/4/23 16:37, Ville Voutilainen wrote:
>>> On Wed, 4 Oct 2023 at 16:35, Andrey Semashev via Std-Proposals
>>> <std-proposals_at_[hidden]> wrote:
>>>> Performance is one part of the issue, the other one is code size. Even
>>>> if there is a fast path, you still have to link the entire
>>>> implementation of std::format.
>>>
>>> ..but if that's templated and inlined and optimized, there's not much
>>> code size bloat, is there?
>>
>> I haven't looked at the implementation, but I would expect at least some
>> part of the parsing code to be precompiled. Otherwise, the code bloat
>> would be immense, as effectively every instantiation of std::format
>> would duplicate the same parsing code.
>>
>> But even templates need to be instantiated and code for them need to be
>> generated. This is compile time and memory consumption. Whether that
>> code will be eliminated by the optimizer is not guaranteed either (e.g.
>> the optimizer could fail or the optimization could be disabled).
>
> Using the as-if rule, it could be hand written and independent of
> `std::format` but behave
> exactly the same. This means no templates and code bloat. This is a QoI problem.

Exactly, this was my original point.

Received on 2023-10-04 13:45:48