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

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

Closed
oowekyala opened this issue Nov 11, 2018 · 1 comment · Fixed by #2969
Closed
Labels
for:performance The goal of this change is to improve PMD's performance in:ruleset-xml About the ruleset schema/parser
Milestone

Comments

@oowekyala
Copy link
Member

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

@oowekyala oowekyala added the for:performance The goal of this change is to improve PMD's performance label Nov 11, 2018
@oowekyala oowekyala added this to the 7.0.0 milestone Nov 11, 2018
@oowekyala oowekyala linked a pull request Jan 18, 2021 that will close this issue
4 tasks
adangel added a commit that referenced this issue Jan 24, 2021
@adangel
Copy link
Member

adangel commented Jan 24, 2021

Fixed with PMD 7 via #2969 .

@adangel adangel closed this as completed Jan 24, 2021
@adangel adangel added the in:ruleset-xml About the ruleset schema/parser label Jan 12, 2023
@adangel adangel mentioned this issue Jan 23, 2023
55 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for:performance The goal of this change is to improve PMD's performance in:ruleset-xml About the ruleset schema/parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants