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

            Bug ID: 107675
           Summary: [13 Regression] GCC-13 is significantly slower to
                    startup on C++ programs
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*

The following simple testcase:

#include <cstdio>

int main(int argc, char** argv) {
    printf("Hello world\n");
    return 0;
}

is on average twice as slow as GCC 12 during startup:

> perf diff perf.data.gcc.12 perf.data.gcc.13

# Event 'cycles'
#
# Baseline  Delta Abs  Shared Object     Symbol
# ........  .........  ................  ...............................
#
   100.00%    +42.66%  gcc-13.exe        [.] fde_single_encoding_compare

Looking at perf the entirety of of the difference is spent in __libc_start_main
which on GCC 13 calls __libc_csu_init which calls init_object.constprop.0.

This constprop function spends half the time in frame_heapsort and the other
half in fde_single_encoding_compare.  Together these two calls are responsible
for the 2x slower startup.

Is it possible to mitigate this? At startup it's currently executing more than
6.5x the number of instructions as GCC-12 which is quite noticeable on small
devices.

Reply via email to