Orasund / elm-ui-widgets

Collection of reusable views for elm-ui.
https://orasund.github.io/elm-ui-widgets/
BSD 3-Clause "New" or "Revised" License
85 stars 11 forks source link

Very high browser CPU consumption on demo page #51

Closed psiphi75 closed 3 years ago

psiphi75 commented 3 years ago

I'm just a passer by, but I noticed that elm-ui-widgets consumes an awful lot of CPU on my browser, 100%+ CPU. I have tested this on Chrome and Firefox with similar behaviour.

I compiled and ran the /example folder, removed the ReusableViews from Main.elm and still 100%+ CPU. I the removed StatelessViews and my CPU usage went down to around 33%. Then I removed Element.inFront snackbarElem and Element.inFront nav (no more menu) and still around 30 to 40% CPU. An idle page (like writing this bug report on GitHub) consumes around 6% of CPU.

I looked at the browser CPU profiling tool and it pointed toward elm-ui being the culprit, but I went to try an elm-ui example at https://ellie-app.com/7Cw4VCyr3RGa1 and my browser is just idle (~6% CPU).

Orasund commented 3 years ago

Thanks for pointing this out, I have a good guess what this might be. (Every 1000ms the demo page askes for the screen position of every example.) But I currently do not have the time to fix this.

Orasund commented 3 years ago

Could not reproduce. But I also noticed that the update actually happened ever 50ms. I've changed it to 2000ms and hopefully that should be it.