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

Make the list proxyInformation and the set resolving of a LazyLinkingResource be created lazily #3317

Open
rubenporras opened this issue Jan 17, 2025 · 2 comments

Comments

@rubenporras
Copy link
Contributor

By doing that, when resources already linked are loaded from storage, no memory needs to be allocated for the proxyInformation list and the resolving set.

@szarnekow
Copy link
Contributor

new ArrayList doesn't allocate the internal array. What kind of savings did you observe from the suggested change?

@rubenporras
Copy link
Contributor Author

rubenporras commented Jan 17, 2025

Hi Sebastian,

that is true, the internal array is not allocated. However, the ArrayList object itself has to be allocated. It is not to be a massive win, but it the object allocation can be saved, it will be slightly better. Our application is a multi-threaded application that deals with many resources loaded on demand and short-lived. Since the code of PR #3318 which is not complex, I think it is worth the effort.

Also note, that even though new ArrayList is not allocating a new array, the current implementation of LazyLinkingResource.clearLazyProxyInformation() is allocating a list with an new allocated internal array if the proxyInformation had entries before. This last point can be fixed by just calling clear on the existing list, which is also part of the proposed PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants