uber-go / fx

A dependency injection based application framework for Go.
https://uber-go.github.io/fx/
MIT License
5.83k stars 290 forks source link

ScopedProvider perf optimization #167

Closed shawnburke closed 7 years ago

shawnburke commented 7 years ago

This guy should probably have a map or something to memoize search results.

https://github.com/uber-go/fx/blob/master/config/provider.go#L58

Might need to also watch change notifications from any memoize'd keys or parents.

ghost commented 7 years ago

Why do you think it should be done on the ScopedProvider level, not Provider? Like yaml https://github.com/uber-go/fx/blob/master/config/yaml.go#L148 And yes, we have a bug on change callback, it should include scope key(GFM-290)

ghost commented 7 years ago

We don't have a scope anymore and introduced a wrapper that caches results, which is used in the YAML provider