Skip to content

GC algorithm changes to reduce complexity and object allocation - #6636

Merged
dlmarion merged 1 commit into
apache:2.1from
dlmarion:gc-alg-optimizations
Nov 10, 2026
Merged

dlmarion merged 1 commit into
apache:2.1from
dlmarion:gc-alg-optimizations

Conversation

@dlmarion

@dlmarion dlmarion commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Assisted-By: OpenAI GPT-6 Luna

@dlmarion dlmarion added this to the 2.1.7 milestone Nov 6, 2026
@dlmarion
dlmarion requested a review from keith-turner November 6, 2026 19:48
@dlmarion dlmarion self-assigned this Nov 6, 2026
@dlmarion
dlmarion requested a review from ddanielr November 6, 2026 19:51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding tests to ensure case is ignored is good.

Comment on lines +323 to +331
private boolean containsBulkPrefix(String path) {
int prefixLength = Constants.BULK_PREFIX.length();
for (int i = 0; i <= path.length() - prefixLength; i++) {
if (path.regionMatches(true, i, Constants.BULK_PREFIX, 0, prefixLength)) {
return true;
}
}
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic matches the original logic and looks like it should be faster using regionMatches and dropping streams.

@ddanielr ddanielr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the test code and blip prefix checks look good.

I'll need to step through the changes in makeRelative more closely but if the tests pass then it's most likely good.

for (String delete : candidateMap.keySet()) {
String[] tokens = delete.split("/");
if (tokens.length == 2) {
int firstSlash = delete.indexOf('/');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should definitely reduce the number of string objects we were creating.

@dlmarion

dlmarion commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Full IT build succeeded

@dlmarion
dlmarion merged commit 56c186d into apache:2.1 Nov 10, 2026
9 checks passed
@dlmarion
dlmarion deleted the gc-alg-optimizations branch November 10, 2026 16:43

@DomGarguilo DomGarguilo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Didn't get my review in before merge. Going to put up a small PR to add a test case for makeRelative()

@DomGarguilo

Copy link
Copy Markdown
Member

Made #6643 to add a test case while reviewing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants