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

Possibility of running multiple sourcekitten services in parallel #721

Closed
acecilia opened this issue Nov 27, 2021 · 6 comments
Closed

Possibility of running multiple sourcekitten services in parallel #721

acecilia opened this issue Nov 27, 2021 · 6 comments

Comments

@acecilia
Copy link

acecilia commented Nov 27, 2021

👋

Context

My machine is an 2019 macbook pro, 8 core CPU. This allows for 16 threads. Thus, when I run yes > /dev/null & 8 times, I am getting a 50% CPU utilization, and when running it 16 times I get 100% utilization:

Screenshot 2021-11-27 at 04 18 26

The problem

I am running the analyze command from swiftlint. When doing that, I observe the following:

  • The CPU utilization usually stays around 50%, even though swiftlint is using concurrentPerform when analyzing and is correctly starting 16 threads (I checked):

    Screenshot 2021-11-27 at 04 14 31
  • There is one unique SourceKitService that takes care of executing all requests

  • I did manually update the source code of swiftlint to start 32 threads, but the CPU utilisation was the same

Seeing above, I am wondering if maybe the single instance of SourceKitService is wrongly limiting the amount of threads it uses to process the requests, not taking full advantage of the available computing power. Thus the question:

  • Is there any way to indicate SourceKitService how many threads to use when handling incoming requests?
  • If not, would it make sense to use multiple SourceKitService?
  • Does this library support running multiple SourceKitService instances? Looking at this line, seems like not currently possible

Thanks! 🙌

@johnfairh
Copy link
Collaborator

You may have misread this, it's SourceKitService (no kitten) which is part of the Swift compiler. I think you'd do better asking the SwiftLint team what their expectations are, and then if it looks to you like they are submitting enough jobs in parallel to SourceKitten, follow up with the Swift SourceKit team.

@acecilia
Copy link
Author

acecilia commented Nov 27, 2021

@johnfairh Yes you are right, I miss-wrote it. Fixed, thanks! 🙌

I added the question in this repository because the issue is mainly about the possibility of running multiple instances of SourceKitService in parallel:

Does this library support running multiple SourceKitService instances? Looking at this line, seems like not currently possible

It looks like swiftlint is sending a correct amount of jobs to SourceKitten, but the SourceKitService may be limiting the amount of them being processed, so one solution would be to start multiple SourceKitService in parallel. Thus the question asking if the library supports it somehow

@johnfairh
Copy link
Collaborator

Right, but SourceKitService is still part of the Swift compiler. SourceKitten does not "start" SourceKitService. That's why the Swift SourceKit team are the people to ask about this.

@acecilia
Copy link
Author

Got it, thanks 🙌

@jpsim
Copy link
Owner

jpsim commented Nov 29, 2021

@johnfairh's right, if you want SourceKit itself to behave differently, then you'd need to discuss that with the team within Swift that works on that. The Source Tooling category of the Swift Forums is a good place to start a discussion on this.

@acecilia
Copy link
Author

Thanks! Already opened a topic, lets see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants