Hello, I have been learning a lot while analyzing this open source project recently. During my analysis, I noticed a TODO message and came up with an simple idea.
- Enhancing memory efficiency by setting the initial capacity of a HashMap.
I have read the contributor guidelines in detail, but there may still be some mistakes.
Comment From: pivotal-cla
@gudrb33333 Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@gudrb33333 Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@gudrb33333 Thank you for signing the Contributor License Agreement!
Comment From: sdeleuze
I see a remaining TODO: optimize
on BeanMap#entrySet
, couldn't we directly use Collections.unmodifiableSet()
with a Set
where we define the initial capacity and remove this TODO?
Comment From: gudrb33333
Do you mean using a Set directly without copying it into a HashMap?
Comment From: sdeleuze
Yes
Comment From: gudrb33333
I researched and discovered SimpleImmutableEntry, then modified the code to directly use Collections.unmodifiableSet().
Comment From: sdeleuze
Thanks, make sense, but I initially missed those changes were done on the CGLIB fork that is included in Spring Framework, and we prefer avoiding doing such refinement on the fork, so I will decline. Thanks for your understanding.
Comment From: gudrb33333
Thank you for the review! It was very motivating for me.