Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11012] Very slow compilation of Kitura test with 5.1 snapshots #53402

Closed
swift-ci opened this issue Jun 25, 2019 · 12 comments
Closed

[SR-11012] Very slow compilation of Kitura test with 5.1 snapshots #53402

swift-ci opened this issue Jun 25, 2019 · 12 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11012
Radar rdar://problem/52194425
Original Reporter djones6 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 16.04 / 18.04, bare metal or Docker for Mac, or macOS
swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-21-a

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee djones6 (JIRA)
Priority Medium

md5: 1e345f437a090cb0f785c5700cc152ac

Issue Description:

Compiling the Kitura test suite with recent Swift 5.1 snapshots takes a very long time (over a minute on a bare-metal Ubuntu 16.04 box, 1m 30s on my Mac). I've narrowed it down to a single test that exhibits this slowness. Here's a comparison of times between 5.0.1 and the latest 5.1 snapshot:

djones6@gruffalo:~/swift51$ git clone https://github.com/IBM-Swift/Kitura.git -b slow_51_compilation ./Kitura-stripped-down && cd Kitura-stripped-down
djones6@gruffalo:~/swift51/Kitura-stripped-down$ swiftenv local 5.0.1
djones6@gruffalo:~/swift51/Kitura-stripped-down$ swift package resolve
djones6@gruffalo:~/swift51/Kitura-stripped-down$ time swift build
[12/12] Compiling Swift Module 'Kitura' (53 sources)

real 0m10.337s
user 0m58.152s
sys 0m4.160s
djones6@gruffalo:~/swift51/Kitura-stripped-down$ time swift build --build-tests
[3/3] Linking ./.build/x86_64-unknown-linux/debug/KituraPackageTests.xctest

real 0m1.083s
user 0m1.820s
sys 0m0.220s

djones6@gruffalo:~/swift51/Kitura-stripped-down$ swiftenv local 5.1-DEVELOPMENT-SNAPSHOT-2019-06-21-a
djones6@gruffalo:~/swift51/Kitura-stripped-down$ swift package clean
djones6@gruffalo:~/swift51/Kitura-stripped-down$ time swift build
[123/123] Merging module Kitura

real 0m11.220s
user 1m4.108s
sys 0m4.340s
djones6@gruffalo:~/swift51/Kitura-stripped-down$ time swift build --build-tests
[8/8] Linking KituraPackageTests.xctest

real    1m17.503s
user    1m18.584s
sys     0m0.232s

Building these (abbreviated) tests with 5.1 took 77 seconds, compared to 1 second for Swift 5.0.1.

This seems to be 100% reproducible on every Linux environment I've tried so far (including under Docker on Mac).

Edit: This also compiles slowly on my Mac with Xcode11.

@swift-ci
Copy link
Collaborator Author

Comment by David Jones (JIRA)

A flame graph from a Linux profile shows most of the time is spent in

@xedin
Copy link
Member

xedin commented Jun 26, 2019

djones6 (JIRA User) Was the snapshot from 6/21 the first one you could reproduce this with?

@xedin
Copy link
Member

xedin commented Jun 26, 2019

Based on the available snapshots it looks like the regression happened sometime between 05/09 and 05/21

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 9, 2019

Comment by David Jones (JIRA)

Is there anything I can do to help narrow this down further?

@swift-ci
Copy link
Collaborator Author

Comment by David Jones (JIRA)

I tried the master development snapshots and I don't see this slow compilation problem there. This only seems to be slow on 5.1 snapshots later than 2019-05-09-a. Here are some timings from a macbook pro, each time running
swift package clean ; swift build ; time swift build --build-tests

swift-DEVELOPMENT-SNAPSHOT (master):
2019-05-09-a: real 0m21.495s
2019-05-15-a: real 0m21.588s
2019-07-02-a: real 0m21.801s
... times seem very consistent.

swift-5.1-DEVELOPMENT-SNAPSHOT:
2019-05-09-a: real 0m19.756s
2019-05-21-a: real 0m49.115s
2019-05-29-a: real 0m52.031s
2019-06-12-a: real 0m51.183s
2019-06-16-a: real 1m25.675s
2019-06-20-a: real 1m25.253s
2019-07-02-a: real 1m22.068s
2019-07-10-a: real 1m20.807s
... looks like two distinct increases in compile time, the first somewhere between 05-09-a and 05-21-a (swift.org doesn't have any snapshots between these dates), then again between 06-12-a and 06-16-a.

However, all these times are significantly slower than 5.0.1: real 0m5.611s

@belkadan
Copy link
Contributor

Finally had time to track this down: #27150

@belkadan
Copy link
Contributor

…though admittedly that's only one change, and maybe there were two. I'm not seeing anything particularly slow in building the tests anymore, though.

@belkadan
Copy link
Contributor

Oh, I misread this most recent message, too. Maybe we have other speedups in master besides what I just tracked down…but this was definitely the biggest thing even with an Xcode 11 compiler. I am a little confused because the problem was introduced in #23867 which was in April.

@belkadan
Copy link
Contributor

5.1 branch (though probably not 5.1.0, not with Xcode 11's GM seed already up): #27164

@xedin
Copy link
Member

xedin commented Sep 13, 2019

Thank you, @belkadan!

@belkadan
Copy link
Contributor

All right, should be in both master and the 5.1 branches. David, would you mind checking to see if speeds are back to normal, or if you're still seeing a significant difference? (I know 5.1 may still be a little slower than 5.0 in some areas, unfortunately, but I didn't observe any other order-of-magnitude problems.)

@swift-ci
Copy link
Collaborator Author

Comment by David Jones (JIRA)

I tried with the latest (2019-09-16-a) 5.1 snapshot and compilation time has returned to roughly the same as 5.0.3. Repeating the experiment from my initial report:
5.0.3: real 0m1.178s, user 0m1.775s, sys 0m0.269s
5.1-DEVELOPMENT-SNAPSHOT-2019-07-25-a: real 0m18.886s, user 0m19.703s, sys 0m0.365s
5.1-DEVELOPMENT-SNAPSHOT-2019-09-16-a: real 0m1.204s, user 0m1.787s, sys 0m0.306s

I'd say that this is now resolved.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance
Projects
None yet
Development

No branches or pull requests

4 participants