Number of threads and performance

Answered

Is number of CPU threads effective to performance of JetBrains IDEs?

For example, if there are two kinds of CPUs - 8 cores/8 threads & 8 cores/16 threads - which is faster for indexing or compiling?

1
8 comments

Hello,

We don't have performance tests with 8 vs 16 threads, but multithreading is actively used in IDE, so 16 threads should be faster.

2
Avatar
Permanently deleted user

@Yaroslav Bedrov

What's confusing me is when the idea has heavy work to do .But the CPU about my MacBook pro 2018 still has 90% in not work status.

To finish the heavy work.IDEA use a lot of time when CPU just use a little

2

Not all the operations utilize all the threads.

Indexing is the most heavy and time consuming one, so it should use all the available threads by default.

caches.indexerThreadsCount Registry option can override this behavior (Help | Find Action | Registry).
1

What are the values for the thread count?  If these are Java threads, how do they relate to the number of Cores that are being consumed (ie: 16 threads can be launched on a single core).  Right now, my setting is -1; does that mean "no limit"?

 

0

Benzacar, Eric

/**
* Returns the best number of threads to be used for indexing at this moment.
* It may change during execution of the IDE depending on other activities' load.
*/
public static int getNumberOfIndexingThreads() {
int threadsCount = Registry.intValue("caches.indexerThreadsCount.restartRequired");
if (threadsCount <= 0) {
int coresToLeaveForOtherActivity = ApplicationManager.getApplication().isCommandLine() ? 0 : 1;
threadsCount = Math.max(1, Math.min(Runtime.getRuntime().availableProcessors() - coresToLeaveForOtherActivity, DEFAULT_MAX_INDEXER_THREADS));
}
return threadsCount;
}
private static final int DEFAULT_MAX_INDEXER_THREADS = 4;
0

So from what I understand, the only option is to set a fixed number of cores (+ve number), or IJ will use 1 less than all the cores available in the system.  There is no way to define the number of cores not to use.  (ie: -3, -4, etc).

I am running IntelliJ IDEA 2019.3.5 (Ultimate Edition).  Build #IU-193.7288.26, built on May 6, 2020

But I can't find the relevant information for this build (https://github.com/JetBrains/intellij-community/blob/193.7288/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java).  Does the logic remain the same, but was just refactored from another class?

0

If you have set it to -1, IDE will not use more than 4 threads for indexing.

If you set it to any number > 0, this specific number of threads will be used. Note that it's the number of threads and can be higher than the number of cores you have. It makes no sense to set it higher than the number of hardware threads your system can support. For example, for 8 core CPU with hyperthreading you will have 16 hardware threads available. If you want to use all the threads for indexing, set caches.indexerThreadsCount to 16. In 2020.x versions the property name has changed to caches.indexerThreadsCount.restartRequired.

1

Please sign in to leave a comment.