Skip to content

[SR-13205] Slow compilation with GuaranteedARCOpts #55645

Open
@lxbndr

Description

@lxbndr
Previous ID SR-13205
Radar None
Original Reporter @lxbndr
Type Bug

Attachment: Download

Environment

Swift version 5.3-dev (LLVM 4510748, Swift bf47403)
Target: x86_64-unknown-windows-msvc

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompileTime, Optimizer
Assignee None
Priority Medium

md5: 16837e10c0c582e8cd7c30b39a7c799b

Issue Description:

Noticed heavy slowdown in compilation of specific code after #32390.

Code contains huge switch with ~1000 cases:

switch mime.lowercased() {     
    case "application/andrew-inset":
        return "ez"
    case "application/applixware":
        return "aw"
    case "application/atom+xml":
        return "atom"
    case "application/atomcat+xml":
        return "atomcat"
...

Normally it compiles in seconds, but now compilation takes about 20 minutes. Looks like removing the .lowercased() call fixes the issue. Compiling with -Xllvm -sil-disable-pass=GuaranteedARCOpts also helps.

Compiling on Windows:

swiftc.exe -emit-library -module-name sr13205 -sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows sr13205.swift -o sr13205.dll

But I think it might be crossplatform. Full code sample attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SILOptimizerArea → compiler: SIL optimization passesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions