From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AD55B3858C66; Wed, 19 Jul 2023 11:33:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD55B3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689766399; bh=GGi19jObexRaawdrkOZmURXYvdqia91zQjCet7XTpI4=; h=From:To:Subject:Date:From; b=Cb81XVo/GDfRGNOWHphxrNDGdNwNMlfpEf85VhS5/kiXzy0z/obQVoozvMaV5+1PU CLX+QWxXvrTE/b4WgniDDzRsgZK3zbY8sfTw/PLF22XMYXI4U2HTVGo/Wsr5sMCe8j R21u1RsLXHy1WN6WQQS5PS+iZiKpxcyVFH6eC0nI= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110739] New: std::format for chrono types compiles very slowly Date: Wed, 19 Jul 2023 11:33:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110739 Bug ID: 110739 Summary: std::format for chrono types compiles very slowly Product: gcc Version: 13.1.1 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Some of the compilation overhead is unavoidable, because we need to parse t= he format string during constant evaluation. But as it says in this comment in bits/chrono_io.h: // TODO this function template is instantiated for every different _T= p. // Consider creating a polymorphic interface for calendar types so // that we instantiate fewer different specializations. Similar to // _Sink_iter for std::format. Replace each _S_year, _S_day etc. with // member functions of that type. template typename _FormatContext::iterator _M_format(const _Tp& __t, _FormatContext& __fc, bool __is_neg =3D false) const=