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
Comment From: pivotal-cla
@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.
Comment From: pivotal-cla
@Shawyeok Thank you for signing the Contributor License Agreement!
Comment From: Shawyeok
Related https://github.com/ctripcorp/apollo/pull/3816#discussion_r667444749
Comment From: snicoll
@Shawyeok thank you for making your first contribution to Spring Framework.
Comment From: Shawyeok
@Shawyeok thank you for making your first contribution to Spring Framework.
It's great to see it get merged even two years later.