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 examples of lazy & memoized #747

Merged
merged 3 commits into from
Apr 15, 2021
Merged

Add examples of lazy & memoized #747

merged 3 commits into from
Apr 15, 2021

Conversation

thomashoneyman
Copy link
Member

This PR adds examples for the lazy and memoized functions. The example works by displaying three results of calling a very poor fibonnaci implementation, with an extra button to toggle the background color of the example. Toggling the background color without memoization leads to extremely slow renders.

The first example re-renders any time the state changes, like normal Halogen, and it's quite slow. The second example uses memoized with eq, and it's quite slow because of #742 (but is fixed in #743). The third example uses lazy and is quite fast.

Here's a demonstration of this example running against master:

master.mov

Notably, the memoized example is still very slow. But if I run this example against the fix-memoized branch used in #743 the result is what we'd expect:

fix-memoized.mov

@thomashoneyman thomashoneyman mentioned this pull request Apr 9, 2021
@thomashoneyman thomashoneyman merged commit d424510 into purescript-halogen:master Apr 15, 2021
@thomashoneyman thomashoneyman deleted the memoized-example branch April 15, 2021 15:06
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.

None yet

2 participants