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

Optimize Map methods in ServletAttributesMap #32197

Closed
bclozel opened this issue Feb 5, 2024 · 1 comment
Closed

Optimize Map methods in ServletAttributesMap #32197

bclozel opened this issue Feb 5, 2024 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Feb 5, 2024

Backport for #32189

@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch labels Feb 5, 2024
@bclozel bclozel added this to the 6.0.17 milestone Feb 5, 2024
@bclozel bclozel self-assigned this Feb 5, 2024
bclozel pushed a commit that referenced this issue Feb 5, 2024
ServletAttributesMap inherited default implementations of the size
and isEmpty methods from AbstractMap which delegates to the Set returned
by entrySet. ServletAttributesMap's entrySet method made this fairly
expensive, since it would copy the attributes to a List, then use a
Stream to build the Set. To avoid the cost, add implementations of
isEmpty / size that don't need to call entrySet at all.

Additionally, change entrySet to return a Set view that simply lazily
delegates to the underlying servlet request for iteration.

Closes gh-32197
Copy link

github-actions bot commented Feb 5, 2024

Fixed via 74bb42b

@github-actions github-actions bot closed this as completed Feb 5, 2024
bclozel added a commit that referenced this issue Feb 5, 2024
@jhoeller jhoeller added the type: enhancement A general enhancement label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: backport An issue that is a backport of another issue to a maintenance branch type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants