-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-14532 |
Radar | rdar://problem/77217125 |
Original Reporter | @kylebshr |
Type | Bug |
Status | Resolved |
Resolution | Done |
Attachment: Download
Environment
Swift 5.4 / Xcode 12.5 / MacBook Pro (15-inch, 2019) 2.4 GHz 8-Core Intel Core i9
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 21019f6eabe58038bcaec8824ea2ecfb
Issue Description:
We have a generated class in our code base with over 3,000 properties, which took a long but somewhat reasonable time to compile in Swift <= 5.3.2. With the release of Swift 5.4 we noticed a huge increase in compile time for our project.
I reduced the repro case to a simple class with 3,000 Int properties, and an init that sets each of those properties, similar to our generated code. Compiling this file takes ~139s with Swift 5.3.2 and ~1278s with Swift 5.4 - nearly a 10x slow down.
➜ huge_class swiftc -v
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
➜ huge_class swiftc -driver-time-compilation main.swift
===-------------------------------------------------------------------------===
Driver Compilation Time
===-------------------------------------------------------------------------===
Total Execution Time: 0.0002 seconds (139.6951 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0000 ( 60.6%) 0.0000 ( 36.3%) 0.0001 ( 46.2%) 139.4823 ( 99.8%) {compile: main-9f2913.o <= main.swift}
0.0000 ( 39.4%) 0.0001 ( 63.7%) 0.0001 ( 53.8%) 0.2128 ( 0.2%) {link: main <= main-9f2913.o}
0.0001 (100.0%) 0.0001 (100.0%) 0.0002 (100.0%) 139.6951 (100.0%) Total
➜ huge_class sudo xcode-select -s /Applications/Xcode.app
Password:
➜ huge_class swiftc -v
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.3.0
➜ huge_class swiftc -v
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.3.0
➜ huge_class swiftc -driver-time-compilation main.swift
===-------------------------------------------------------------------------===
Driver Compilation Time
===-------------------------------------------------------------------------===
Total Execution Time: 0.0001 seconds (1278.5112 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0000 ( 74.0%) 0.0000 ( 50.8%) 0.0001 ( 61.1%) 1278.2003 (100.0%) {compile: main-018ae1.o <= main.swift}
0.0000 ( 26.0%) 0.0000 ( 49.2%) 0.0000 ( 38.9%) 0.3109 ( 0.0%) {link: main <= main-018ae1.o}
0.0000 (100.0%) 0.0001 (100.0%) 0.0001 (100.0%) 1278.5112 (100.0%) Total
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself