Skip to content

Improve performance by maintaining sort of application listeners [SPR-17308] #21841

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

Closed
spring-projects-issues opened this issue Sep 27, 2018 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 27, 2018

Samuel Bratton opened SPR-17308 and commented

There's a slight but measurable performance hit due to sorting application listeners in AbstractApplicationEventMulticaster.java, even with as few as 2 listeners. The cost is incurred on every call to getApplicationListeners()when listeners are sorted (

) By maintaining a sorted list as entries are added/removed this cost is reduced. There is a proposed change which can be mad a pull request here: https://github.com/sebratton/spring-framework/tree/sort-application-listeners


Affects: 4.3.19, 5.0.9

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 27, 2018

Samuel Bratton commented

Hi, as I was working on opening this jira, I missed that a jira had already been opened on essentially the same issue an hour or so earlier, #21840, I reference a proposed code change in the description above but it only addresses one of the two listener types mentioned in #21840.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 29, 2018

Juergen Hoeller commented

The revision applied for #21840 should hopefully address this case as well, maintaining a pre-sorting list in the cached retriever (for the common singleton case). This will be available in the upcoming 5.1.1.BUILD-SNAPSHOT; let me know if this doesn't provide the effect that you expected.

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) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants