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

Improve performance of CompositePropertySource#getPropertyNames #27236

Conversation

Shawyeok
Copy link
Contributor

@Shawyeok Shawyeok commented Aug 2, 2021

Create LinkedHashSet with a initialCapacity, prevent underhood table resize cost in continuous add operations.
Reduce bootstrap time in the situation with large properties.

Micro-Benchmark CompositePropertySourceBenchmark result (unit: ns/op):

numberOfPropertySource: 5
numberOfPropertyNamesPerSource: 1000

  Baseline New
  369339 265699
  372184 266577
  375854 267332
  375830 266348
  376366 265801
Avg 373915 266352
Cost 1 0.71

numberOfPropertySource: 10
numberOfPropertyNamesPerSource: 1000

  Baseline New
  794450 556300
  793987 611713
  799981 577572
  803261 554797
  807606 565953
Avg 799857 573267
Cost 1 0.72

@pivotal-cla
Copy link

@Shawyeok Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 2, 2021
@pivotal-cla
Copy link

@Shawyeok Thank you for signing the Contributor License Agreement!

@Shawyeok
Copy link
Contributor Author

Shawyeok commented Aug 2, 2021

Related apolloconfig/apollo#3816 (comment)

Create LinkedHashSet with a initialCapacity, prevent underhood table
resize cost in continuous add operations. Reduce bootstrap time in the
situation with large properties.
@Shawyeok Shawyeok force-pushed the hotfix/improve-performance-of-get-property-names branch from aefda4b to 6f94f9f Compare August 2, 2021 07:03
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 11, 2021
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 26, 2023
@snicoll snicoll self-assigned this Aug 26, 2023
@snicoll snicoll added this to the 6.1.0-RC1 milestone Aug 26, 2023
snicoll pushed a commit that referenced this pull request Aug 26, 2023
Create LinkedHashSet with a initialCapacity, prevent under the hood
table resize cost in continuous add operations. Reduce bootstrap time
in the case of large properties.

See gh-27236
@snicoll snicoll closed this in ce4a5b1 Aug 26, 2023
@snicoll
Copy link
Member

snicoll commented Aug 26, 2023

@Shawyeok thank you for making your first contribution to Spring Framework.

@Shawyeok
Copy link
Contributor Author

@Shawyeok thank you for making your first contribution to Spring Framework.

It's great to see it get merged even two years later.

@sbrannen sbrannen changed the title Improve performance of CompositePropertySource#getPropertyNames Improve performance of CompositePropertySource#getPropertyNames Aug 27, 2023
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.

None yet

5 participants