-
Notifications
You must be signed in to change notification settings - Fork 140
Speed up getBean() for singletons with complex dependencies? #409
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
Comments
Ensure we don't overwrite any cached dependencies
This provides a substantial speedup in the pathological case and doesn't appear to break anything so I'm inclined to close this out as "fixed" but I want to get feedback from @cameroncf first. |
I ran this on my stand alone test code and saw a pretty healthy jump in performance. This is definitely a big improvement - about 25-30x, which agrees with the numbers you saw. I've also tried the updates DI/1 file out in a full blown "pathological" application that had problems around getBean() and there is a performance boost there too. Not quite as large since DI/1 is only a part of the larger app, but it seems to have sped things up overall by about 30% overall in that app. I suspect others will experience some performance gain form these changes as well, though it will probably be far less dramatic than my somewhat extreme edge case. I plan to do a lot of work in the app today with getBean() and removing the pathological nature of the code so I'll report back if I find any other negative side effects of this change. I looked at the code you changed though and it looks pretty safe. |
Thanks for your feedback @cameroncf -- I'll consider this "done" now! Feel free to post back with your findings tho' as it will be useful information for others (and for the 4.0 release notes!). |
Can we safely add a top-level cache for singletons so that explicit calls to getBean() are very fast?
The text was updated successfully, but these errors were encountered: