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-608] Provide automatic features for exposing Swift function profiling data #5323

Open
ddunbar opened this issue Jan 24, 2016 · 4 comments
Labels
enhancement good first issue Good for newcomers Edit

Comments

@ddunbar
Copy link
Member

ddunbar commented Jan 24, 2016

Previous ID SR-608
Radar None
Original Reporter @ddunbar
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature, StarterBug
Assignee None
Priority Medium

md5: 03fe6c3771211358a4f1f23f58df8c31

Issue Description:

swiftpm should have a feature where we automatically enable and extract the per-function time data from the compiler, then aggregate it and report it.

This could be invaluable for people who are having performance issues with large Swift projects.

@belkadan
Copy link

Please do not do this without actually making the per-function timing data a more user-friendly feature. It's hidden behind -Xfrontend because it was meant as a debugging option for us; it is not considered a supported feature of the compiler.

@belkadan
Copy link

(In particular, there are a number of things that this timing data does not include that it should, including initial value expressions for properties.)

@abertelrud
Copy link
Contributor

Sounds like a useful feature but we will absolutely need to coordinate this with the compiler (and not just expose what happens to be available there now without coordination).

@swift-ci
Copy link
Contributor

Comment by Andrew Bennett (JIRA)

@belkadan I couldn't find a ticket for this on the compiler, do you know if there is one? It'd be nice to have a more complete wish-list for this feature 🙂

You mention on one commit:

  • Other parts of type-checking not measured by this may also be slow.

  • May include first-use penalties (i.e. "this is slow because it's
    the first function that references an imported type, which causes
    many things to be imported")

  • Does not report anything whatsoever about other phases of compilation
    (SILGen, optimization, IRGen, assembly emission, whatever).

  • Does not catch anything accidentally being type-checked multiple times
    (a known issue for initial value expressions on properties).

In case anyone decides to take a look at it, I've added some notes after a brief look myself:

This function seems to be the guts of the current implementation:
https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckStmt.cpp#L147

Also worth looking at:

-debug-time-function-bodies: dump time spent type-checking each function
apple/swift@8612e24

Add frontend option "-warn-long-function-bodies=<N>".
apple/swift@18c7592

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@tomerd tomerd added good first issue Good for newcomers Edit and removed Package Manager labels May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Good for newcomers Edit
Projects
None yet
Development

No branches or pull requests

5 participants