In JS, you could measure the time of each iteration and then only do so many that it would fit into a “frame budget” (so < 16ms, or if you are updating the DOM you would probably only spend say 10ms). However, I’m not sure how easy that would be in Elm.
On Jul 2, 2017, 20:59 +0300, 'Rupert Smith' via Elm Discuss <[email protected]>, wrote: > On Friday, June 30, 2017 at 9:43:51 AM UTC+1, Jakub Hampl wrote: > > One way of approaching this is to show the user progress in an interesting > > way. In this example, the computation that calculates the final layout of a > > network graph (which is pretty expensive) is animated so the user can watch > > the algorithm converge. > > Nice example, I like how you can interrupt it by clicking on one of the other > examples, so the UI is not getting frozen. > > One thing about this example, is that is driven off of a timer tick. So if > each iteration of the node layout takes say one microsecond of CPU time, and > the timer ticks every millisecond - it will only use 1/1000th of the CPU. Its > fine for animation. > > In my case I don't want to use a timer tick to drive the computation, because > I want to use 100% of the CPU (or close to it) to complete a computation as > quickly as possible, but still not block user interaction. > > We had a good first Elm Scotland Meetup btw, hope you can make the next one. > -- > You received this message because you are subscribed to a topic in the Google > Groups "Elm Discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elm-discuss/M5teKjboylI/unsubscribe. > To unsubscribe from this group and all its topics, 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.
