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

Performance suggestion: Make the mapper in oneWayMap bindings lazy or memoized #43

Closed
cmeeren opened this issue Aug 4, 2018 · 1 comment

Comments

@cmeeren
Copy link
Member

cmeeren commented Aug 4, 2018

As far as I can see, oneWayMap represents an optimization over oneWay in the sense that PropertyChanged will not be triggered unless the return value of getter has changed. However, if there are multiple bindings from XAML to a single oneWayMap (e.g. one to display text and another to select a color based on the text using an IValueConverter), then the mapper will still be called several times.

It seems to me there should be a fairly simple fix wherein Elmish.WPF could use lazy to ensure that until the getter output has changed (or, if simpler, until the model is updated, though that's a lesser optimization), mapper is called at most once.

I haven't been able to figure out how, though. Any thoughts?

@cmeeren
Copy link
Member Author

cmeeren commented Sep 1, 2018

Closed by #48

@cmeeren cmeeren closed this as completed Sep 1, 2018
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

Successfully merging a pull request may close this issue.

1 participant