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

maxCoresPercentageToUseForBackgroundIndexing is too high by default #1836

Open
MahdiBM opened this issue Nov 19, 2024 · 2 comments
Open

maxCoresPercentageToUseForBackgroundIndexing is too high by default #1836

MahdiBM opened this issue Nov 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MahdiBM
Copy link
Contributor

MahdiBM commented Nov 19, 2024

Swift version

Swift 6.0.2 release

Platform

Editor

VS Code

Description

maxCoresPercentageToUseForBackgroundIndexing is set to 100% by default. I think that's too much.
I'd say let's lower it to 80/70% and anyone who wants maximum performance can increase it.
It's quite rare that something makes my M1 Macbook's fans spin ... and background indexing did achieve that.

Steps to Reproduce

Enabled background indexing on a big enough project.

Logging

No response

@MahdiBM MahdiBM added the bug Something isn't working label Nov 19, 2024
@ahoppen
Copy link
Member

ahoppen commented Nov 19, 2024

Synced to Apple’s issue tracker as rdar://140186846

@ahoppen
Copy link
Member

ahoppen commented Nov 19, 2024

maxCoresPercentageToUseForBackgroundIndexing is a little misleading and maybe we should remove the setting altogether. Even when setting it to 0.8, it might use all your CPU cores because background preparation invokes swift build --experimental-prepare-for-indexing and we don’t know how many cores that takes and we assume that it’s a single one.

All background activity happens with a lower priority on the OS level (high nice value, set here) unless it’s required for functionality in the current file. This should ensure that other higher priority tasks take precedence. And I think using system functionality like this is the better than trying to do process scheduling ourselves by limiting the number of cores we use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants