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

Limit parallel jobs to 1 / use in-memeory pch storage #177

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Feb 5, 2024

Please check if the PR fulfills these requirements

What kind of change does this PR introduce?
Limit the number of concurrent indexing jobs on clangd

What is the current behavior?
The number of concurrent jobs equals the number of available CPU cores. This may lead to unusable systems in some cases...

What is the new behavior?
Limit the jobs to 1 core (2 threads if hyperthreaded).

Other information:
Fix #176 (already confirmed by @facchinm)

@cmaglie cmaglie self-assigned this Feb 5, 2024
@cmaglie cmaglie requested a review from a team February 5, 2024 15:42
@cmaglie cmaglie added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Feb 5, 2024
@cmaglie cmaglie mentioned this pull request Feb 5, 2024
@kittaakos
Copy link
Contributor

@cmaglie, would you like me to create an IDE2 build for the verification with this LS? If yes, does this LS work with the 0.36.0-rc.x CLI API?

Please update the PR description with links to the corresponding clangd flags.

Don't we want to let users configure how many cores they wish to use for clangd? If yes, we should create an IDE2 preference and pass the -j value into the Arduino LS. What's your take on this?

Thank you!

@cmaglie
Copy link
Member Author

cmaglie commented Feb 6, 2024

would you like me to create an IDE2 build for the verification with this LS? If yes, does this LS work with the 0.36.0-rc.x CLI API?

No problem with that, I made the PR starting from the previous tagged version of the language server, and since I'm going to merge with a merge-commit I can make a release for both Arduino CLI 0.35.2 and 0.36.x.

Don't we want to let users configure how many cores they wish to use for clangd? If yes, we should create an IDE2 preference and pass the -j value into the Arduino LS. What's your take on this?

Good point, I will add a flag to set the number of threads on this PR

@cmaglie cmaglie merged commit de4b55c into main Feb 6, 2024
17 checks passed
@cmaglie cmaglie deleted the limit-concurrent-jobs branch February 6, 2024 13:18
cmaglie added a commit that referenced this pull request Feb 6, 2024
@cmaglie
Copy link
Member Author

cmaglie commented Feb 6, 2024

Released in 0.7.6, this version is compatible with Arduino CLI 0.35.2.

The current main is for the next Arduino CLI >=0.36.x.

kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this pull request Feb 6, 2024
Ref: arduino/arduino-language-server#177
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this pull request Feb 6, 2024
 chore: bump version for the release
 test: use the latest CLI version for testing
 feat(test): improve logging for tests
   - log when core install starts
 fix(test): regressions due to platform change
   - change core version to `3.0.0-arduino3r2`,
   - the vendor ID is `arduino` and not `esp32`
anymore, and
   - use the AVR core for negative tests: it does
not have a default programmer set. Hence, the
expected error is no triggered.

Ref: arduino/arduino-language-server#177

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Feb 6, 2024
Added a new preference (`arduino.language.asyncWorkers`) to control the
number of async workers used by `clangd`.
Users can use fine tune the `clangd` thread count to overcome excessive
CPU usage.

Ref: arduino/arduino-language-server#177
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/vscode-arduino-tools that referenced this pull request Feb 7, 2024
 chore: bump version for the release
 test: use the latest CLI version for testing
 feat(test): improve logging for tests
   - log when core install starts
 fix(test): regressions due to platform change
   - change core version to `3.0.0-arduino3r2`,
   - the vendor ID is `arduino` and not `esp32`
anymore, and
   - use the AVR core for negative tests: it does
not have a default programmer set. Hence, the
expected error is no triggered.

Ref: arduino/arduino-language-server#177

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Feb 7, 2024
Added a new preference (`arduino.language.asyncWorkers`) to control the
number of async workers used by `clangd`.
Users can fine tune the `clangd` thread count to overcome the excessive
CPU usage.

Use 0.1.2 Arduino Tools VSIX in IDE2.

Ref: arduino/arduino-language-server#177
Ref: arduino/vscode-arduino-tools#46

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Feb 7, 2024
Added a new preference (`arduino.language.asyncWorkers`) to control the
number of async workers used by `clangd`.
Users can fine tune the `clangd` thread count to overcome the excessive
CPU usage.

Use 0.1.2 Arduino Tools VSIX in IDE2.

Ref: arduino/arduino-language-server#177
Ref: arduino/vscode-arduino-tools#46

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High CPU usage (clangd)
3 participants