Open
Description
Previous ID | SR-13205 |
Radar | None |
Original Reporter | @lxbndr |
Type | Bug |
Attachment: Download
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.