public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100393] New: Very slow compilation of switch statement with thousands of cases
@ 2021-05-03 11:46 curiousdannii at gmail dot com
  2021-05-03 12:04 ` [Bug c/100393] " curiousdannii at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: curiousdannii at gmail dot com @ 2021-05-03 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100393
           Summary: Very slow compilation of switch statement with
                    thousands of cases
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: curiousdannii at gmail dot com
  Target Milestone: ---

I have a switch statement with almost 11,000 cases (produced by a decompiler),
which is taking almost 5 minutes to compile with GCC 10.2. Helpful people on
Stack Overflow suggested that it was a regression, that it only took 3 seconds
to compile with GCC 8.4, and for comparison, only 1.3 seconds in Clang. I
haven't been able to confirm those results yet, but I'll look into doing so.

SO discussion: https://stackoverflow.com/q/67363813/2854284

Preprocessed source:
https://gist.githubusercontent.com/curiousdannii/9476375ff3ae22c403ce2a8132e6a5dc/raw/568f519f2f1b599e98c514f3609a4968d4153eed/functions_unsafe.i

The `-ftime-report -ftime-report-details` results (full results in the SO page)
show that the slow part is in "tree switch lowering".

I also tried compiling it with `-fno-jump-tables`, which, rather than helping,
made it much worse, taking over 33 minutes to compile.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-11-05 16:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 11:46 [Bug c/100393] New: Very slow compilation of switch statement with thousands of cases curiousdannii at gmail dot com
2021-05-03 12:04 ` [Bug c/100393] " curiousdannii at gmail dot com
2021-05-03 13:37 ` [Bug tree-optimization/100393] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org
2021-05-03 13:48 ` rguenth at gcc dot gnu.org
2021-05-03 13:58 ` rguenth at gcc dot gnu.org
2021-05-10 12:22 ` marxin at gcc dot gnu.org
2021-06-01  8:20 ` rguenth at gcc dot gnu.org
2021-08-13 15:25 ` marxin at gcc dot gnu.org
2021-08-13 15:26 ` marxin at gcc dot gnu.org
2021-08-16 11:38 ` cvs-commit at gcc dot gnu.org
2021-08-16 11:38 ` [Bug tree-optimization/100393] [9/10/11 " marxin at gcc dot gnu.org
2021-11-05 16:09 ` cvs-commit at gcc dot gnu.org
2021-11-05 16:10 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).