November 05, 2022
https://issues.dlang.org/show_bug.cgi?id=23464

          Issue ID: 23464
           Summary: Pathological compilation slowdown when mixin in large
                    switches
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: deadalnix@gmail.com

Unfortunately, because this bug require to mix in a large switch, I'm not able to share a small sample code.

You can find an example able to trigger the problem here: https://github.com/snazzy-d/sdc/tree/compiletime

The compilation time is dominated by the mixin in lexHtmlEntity in lexstring.d

With this function, compiling the json lexer takes 45s on my system. Without it, it takes 0.3s .

There seems to be something non linear somewhere, because similar switches are mixed in in other places, but the one in lexHtmlEntity is definitively the biggest one.

--