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

Add ViewData for internal view owned state #176

Merged
merged 2 commits into from
Nov 15, 2023
Merged

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Nov 14, 2023

This add ViewData for internal view owned state.

Storing view state in ViewData instead of ViewState has a couple of benefits:

  • It can be accessed in passes without a hash map lookup.
  • Decorators can write to it directly instead of using update messages for the initial value.
    The downside is that updating ViewData by a message requires walking the view tree, which is probably more expensive.

Overall I think it's a good tradeoff as it favors view passes and view creation which does seem to be the slowest parts.

The style field is moved from ViewState to ViewData.

@dzhou121 dzhou121 merged commit ec99b9c into lapce:main Nov 15, 2023
7 checks passed
@Zoxc Zoxc deleted the view_data branch November 15, 2023 13:30
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 this pull request may close these issues.

2 participants