Skip to content

Use Map::computeIfAbsent where feasible #33824

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

Closed
wants to merge 1 commit into from

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Oct 31, 2024

No description provided.

@sbrannen sbrannen added status: waiting-for-triage An issue we've not yet triaged or decided on type: task A general task labels Oct 31, 2024
@quaff quaff marked this pull request as draft October 31, 2024 08:42
@quaff quaff marked this pull request as ready for review October 31, 2024 08:56
@jhoeller
Copy link
Contributor

We had some performance regressions in the past with the use of computeIfAbsent, so let's be rather careful there. There's also the overhead of the lambda instance but primarily it's the stronger locking of computeIfAbsent as opposed to separate get and put steps.

@quaff
Copy link
Contributor Author

quaff commented Nov 1, 2024

We had some performance regressions in the past with the use of computeIfAbsent, so let's be rather careful there. There's also the overhead of the lambda instance but primarily it's the stronger locking of computeIfAbsent as opposed to separate get and put steps.

I didn't aware of that, could someone helps to identify which parts should be reverted, or should I close this PR?

@bclozel
Copy link
Member

bclozel commented Nov 1, 2024

All calls to concurrent collections and ad hoc caches. Which is most of what this PR is.
The rest is mostly cosmetic changes and is not adding much.

@bclozel bclozel closed this Nov 1, 2024
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on type: task A general task labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants