Skip to content

[core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string #1451

@oowekyala

Description

@oowekyala

See here:

public Reader filterRuleSetFile(InputStream stream) throws IOException {
byte[] bytes = IOUtils.toByteArray(stream);
String encoding = determineEncoding(bytes);
String ruleset = new String(bytes, encoding);
ruleset = applyAllFilters(ruleset);
return new StringReader(ruleset);
}

applyAllFilters performs a bunch of regex replacements on the entire String, which creates many copies of it. We could do better by only filtering the ref attributes when parsing a rule reference node, this just seems very inefficient.

@jsotuyod This may offset your performance comparison of DOM and SAX for #724

Metadata

Metadata

Assignees

No one assigned

    Labels

    for:performanceThe goal of this change is to improve PMD's performancein:ruleset-xmlAbout the ruleset schema/parser

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions