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

Avoid empty array allocations in AnnotationTypeMapping #33507

Conversation

kilink
Copy link
Contributor

@kilink kilink commented Sep 9, 2024

Avoid empty array allocations in a few places in AnnotationTypeMapping.

In a heap dump for a production app, there were a couple hundred empty int arrays referenced from AnnotationTypeMapping instances (~3kb of waste); there were also about ~60 empty MirrorSet arrays (~1kb of waste).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 9, 2024
@bclozel bclozel added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 9, 2024
@bclozel bclozel added this to the 6.2.0-RC1 milestone Sep 9, 2024
@sdeleuze
Copy link
Contributor

sdeleuze commented Sep 10, 2024

@kilink Any chance you could provide a feedback on my question above? If not, I plan to merge your PR without the commented change.

@kilink
Copy link
Contributor Author

kilink commented Sep 10, 2024

@kilink Any chance you could provide a feedback on my question above? If not, I plan to merge your PR without the commented change.

Sorry, have been somewhat busy and hadn't got a chance to look at it. What you said it probably correct, I was likely just over-aggressive in trying to eliminate possible empty array allocations here. I can push up a change that removes that line.

Avoid empty array allocations in a few places in AnnotationTypeMapping.
@kilink kilink force-pushed the annotation-type-mapping-empty-array-allocations branch from 10e841e to 66b5741 Compare September 10, 2024 16:44
@kilink
Copy link
Contributor Author

kilink commented Sep 10, 2024

I double-checked, I only see the problem in AnnotationTypeMapping (and indirectly TypeMappedAnnotation):

image

I went ahead and reverted that line.

@sdeleuze sdeleuze closed this in 7827188 Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants