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:42:01 +0300
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).

Received on 2023-10-04 13:42:13