https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110739

            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 the
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 _Tp.
      // 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 _Tp, typename _FormatContext>
        typename _FormatContext::iterator
        _M_format(const _Tp& __t, _FormatContext& __fc,
                  bool __is_neg = false) const

Reply via email to