Hi! The first thing I'd check is whether your view or update functions end up doing O(n) operations (like iteration) with the large list. (Perhaps searching through it for some reason to do validation as the form changes? If that's the problem, then you'll want to consider alternate data structures to instead store the data in the list in a way that optimizes the access you need.
If you've ruled that out, then it's likely that your view function is taking a long time. The entire virtual dom will be recomputed from your model after every update, even though the real dom will be update incrementally. To improve this, isolate the largest piece of your view that depends on the large list but doesn't depend on the form data, and wrap that piece in Html.lazy. Let us know if any of that helps. --Aaron V. On Apr 3, 2017 6:32 AM, "Jais Cheema" <[email protected]> wrote: > Hi, > > I am currently working on a SPA which stores a list of records (~ 2500) > with 4 fields in the model. One of those fields is another list which > contains 2 items on average but can be more. > > I am implementing a form component to create a new item, and the issue I > am seeing is that there is a very noticeable lag after every action. Form > does not deal with the previous mentioned list, but updates another record > which is a part of the list. Below is simplified version of my model code. > > type alias Parent = > { id: Int > , title: String > , children: List Child > } > > type alias Child = > { id: Int > , title: String > } > > type alias Form = > { title: String } > > type alias Model = > { rootNodes: List Parent > , rootNodeForm: Maybe Form > } > > > Can someone please recommend how can I overcome this issue? Or even > pointers on what actions are expensive in Elm and I should be avoiding when > dealing with large amount of data in your model? > > Thank you in advance :) > > Cheers > Jais Cheema > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
