Skip to content

Performance improvement: PsiFileValidator#isScannable #679

@AB-xdev

Description

@AB-xdev

Problem description

The following methods inside PsiFileValidator#isScannable always call PluginConfigurationManager#getCurrent():

&& isInSource(psiFile, pluginConfig, overrideConfigLocation)
&& isValidFileType(psiFile, pluginConfig)
&& isScannableIfTest(psiFile, pluginConfig)

The call to PluginConfigurationManager#getCurrent() always causes the complete configuration to be populated:

public PluginConfiguration getCurrent() {
final PluginConfigurationBuilder defaultConfig = PluginConfigurationBuilder.defaultConfiguration(project);
return projectConfigurationState()
.populate(defaultConfig)
.build();

Currently this only causes a noteworthy performance impact when (bulk) scanning a lot of files, however it's still noteable.

I was not able to find any valid explanation for the current behavior. According to git blame the code was last touched in 2015.

Proposed solution

Hand over the PluginConfiguration instead of the PluginConfigurationManager and only get the configuration once

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions