Skip to content

support shrink for ConcurrentLong map or set - #3074

Merged
merlimat merged 5 commits into
apache:masterfrom
lordcheng10:support_shrink
Mar 3, 2022
Merged

merlimat merged 5 commits into
apache:masterfrom
lordcheng10:support_shrink

Conversation

@lordcheng10

Copy link
Copy Markdown
Contributor

Motivation

support shrink for ConcurrentLong map or set.

@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

@lordcheng10

Copy link
Copy Markdown
Contributor Author

@eolivelli @merlimat PTAL,thanks!

@merlimat merlimat 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.

Change looks good. We should also add tests for the shrink operations.

@lordcheng10

Copy link
Copy Markdown
Contributor Author

Change looks good. We should also add tests for the shrink operations.

Fixed. PTAL,thanks! @merlimat

@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

1 similar comment
@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

@lordcheng10

Copy link
Copy Markdown
Contributor Author

@eolivelli PTAL,thanks!

@eolivelli eolivelli 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.

Lgtm

Great work

@merlimat PTAL

@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

1 similar comment
@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

@merlimat merlimat added this to the 4.15.0 milestone Feb 24, 2022
@lordcheng10

Copy link
Copy Markdown
Contributor Author

rerun failure checks

@lordcheng10

Copy link
Copy Markdown
Contributor Author

@merlimat @eolivelli pTAL,thanks!

@lordcheng10

Copy link
Copy Markdown
Contributor Author

Ping

@lordcheng10

Copy link
Copy Markdown
Contributor Author

@merlimat PTAL,thanks!

@merlimat
merlimat merged commit 74b00a1 into apache:master Mar 3, 2022
zymap pushed a commit that referenced this pull request Jul 26, 2022
### Motivation

Optimize concurrent collection's shrink and clear logic

### Changes
1. Reduce the repeated `Arrays.fill` in the clear process
2. When `capacity` is already equal to `initCapacity`,`rehash` should not be executed
3. Reduce the `rehash` logic in the `clear` process
4. Shrinking must at least ensure `initCapacity`, so as to avoid frequent shrinking and expansion near `initCapacity`, frequent shrinking and expansion, additionally opened `arrays` will consume more memory and affect GC.

If this PR is accepted, I will optimize the same `concurrent collection's shrink and clear logic ` defined in pulsar.

Related to #3061 and #3074
zymap pushed a commit that referenced this pull request Aug 2, 2022
### Motivation

Optimize concurrent collection's shrink and clear logic

### Changes
1. Reduce the repeated `Arrays.fill` in the clear process
2. When `capacity` is already equal to `initCapacity`,`rehash` should not be executed
3. Reduce the `rehash` logic in the `clear` process
4. Shrinking must at least ensure `initCapacity`, so as to avoid frequent shrinking and expansion near `initCapacity`, frequent shrinking and expansion, additionally opened `arrays` will consume more memory and affect GC.

If this PR is accepted, I will optimize the same `concurrent collection's shrink and clear logic ` defined in pulsar.

Related to #3061 and #3074

(cherry picked from commit a580547)
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
* support shrink for ConcurrentLong map or set

* fix unit test

* check style

* add shrink unit test.

* fix unit test
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
### Motivation

Optimize concurrent collection's shrink and clear logic

### Changes
1. Reduce the repeated `Arrays.fill` in the clear process
2. When `capacity` is already equal to `initCapacity`,`rehash` should not be executed
3. Reduce the `rehash` logic in the `clear` process
4. Shrinking must at least ensure `initCapacity`, so as to avoid frequent shrinking and expansion near `initCapacity`, frequent shrinking and expansion, additionally opened `arrays` will consume more memory and affect GC.

If this PR is accepted, I will optimize the same `concurrent collection's shrink and clear logic ` defined in pulsar.

Related to apache#3061 and apache#3074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants