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

The app builds too long, in case of a lot of messages to handle in the Update function #28

Closed
YevheniyGloba opened this issue Aug 8, 2017 · 5 comments

Comments

@YevheniyGloba
Copy link

Hello.
I have a question regarding handling a lot of messages in the Main file for update section: type Msg = SetRoute (Maybe Route) | HomeLoaded (Result PageLoadError Home.Model) ...

Imagine that you have a lot of these messages (in our example we have 32 messages, and 31 of them are like HomeLoaded (Result PageLoadError Home.Model) .. and HomeMsg Home.Msg)
And here we have a problem with building our app - it takes up to 50 seconds to build app.

Could you help us? Could you give us some help?

@mbomhoff
Copy link

mbomhoff commented Aug 11, 2017

We are seeing the same issue with long build times, however our code has 67 messages and takes about 10 minutes to build. Please see https://github.com/hurwitzlab/elm-imicrobe-spa

@mbomhoff
Copy link

Apparently this is a known issue with tuple pattern matching in elm 0.18: https://groups.google.com/d/topic/elm-dev/QGmwWH6V8-c/discussion

I followed the suggestion in the thread of breaking the tuple matching into nested cases and my build time decreased to 3-4 seconds.

For example, instead of case (msg, page) of use case msg of and redundantly handle the _ page cases where needed.

@YevheniyGloba
Copy link
Author

@mbomhoff, thanks.
we have changed message handlers to reduce the number of possible variants in the case statement, and it works

@rtfeldman
Copy link
Owner

Can this be closed? Seems like it has been worked out. 😄

@YevheniyGloba
Copy link
Author

@rtfeldman yes, it could be closed

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

No branches or pull requests

3 participants