-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] [PERF] Cache FactoryManagers #15009
Conversation
* 1 FactoryManager per container/normalizeFullName * cache madeToString per factoryManager
let factory = this.registry.resolve(normalizedName); | ||
|
||
if (factory === undefined) { return; } | ||
if (factory === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should misses not cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought so, but there where test failures and I'm tired :P Maybe i can convince @chadhietala to investigate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve
does also cache so its not the end of the world either..
Added tests to make sure the |
packages/container/lib/container.js
Outdated
@@ -38,6 +38,7 @@ export default function Container(registry, options) { | |||
this.owner = options && options.owner ? options.owner : null; | |||
this.cache = dictionary(options && options.cache ? options.cache : null); | |||
this.factoryCache = dictionary(options && options.factoryCache ? options.factoryCache : null); | |||
this.factoryManagerCache = dictionary(options && options.factoryCache ? options.factoryCache : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not share the same cache as this.factoryCache
. I suspect this should be:
this.factoryManagerCache = dictionary(options && options.factoryManagerCache ? options.factoryManagerCache : null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a commit fixing this
Thanks @chadhietala |
benchmarks (4.7x improvement):
|
[fixes #15007]