cultureamp / react-elm-components

Write React components in Elm
https://www.npmjs.com/package/react-elm-components
BSD 3-Clause "New" or "Revised" License
779 stars 54 forks source link

Demo maxes out CPU usage in Chrome for me #2

Closed JobLeonard closed 8 years ago

JobLeonard commented 8 years ago

Chrome tends to do so when loading a new page anyway, but here it seems stuck. I recorded my desktop to show:

https://youtu.be/SPKh7dlDvI8

I wouldn't be surprised if it actually is a Chrome bug, but it's still annoying that it causes my laptop to freeze and ignore half of the input (including making it hard to close the tab). I don't have this issue with Firefox.

Running Ubuntu 16.04

evancz commented 8 years ago

Interesting, thanks for the video!

If you modify index.jsx to take out the emoji picker, does it still go wrong?

If you take out the Elm websocket stuff, does it still go wrong?

This will localize the problem to Elm things or the somewhat crazy emoji picker I got off the shelf. It actually loads ALL the emoji as images all at once from some CDN, so that'd be my theory on what's up.

Anyway, let me know the results of those two questions!

JobLeonard commented 8 years ago

Writing this during breakfast; will try your suggestions later during a break at work.

It seems it is no longer stuck... what does happen, trying this gain, is that in any browser, CPU usage is maximised for a while. Could there be some poorly coded webworker thing going on? Because it's rare that a website maxes out all of my cores, and my first guess would be that yesterday it got stuck waiting for an emoji to download.

evancz commented 8 years ago

Nothing like that in any Elm code. I suspect that browsers can spin up worker threads for downloads, and since the React component is triggering literally hundreds of simultaneous image downloads, I can see something like this happening.

JobLeonard commented 8 years ago

I'll try your suggestions from earlier and if it's the emoji picker we can safely close this (and open an issue on the Emoji Picker page about using sprite sheets or something). However, there's a small issue:

job@job-ThinkPad-T440s-Ubuntu ~/D/e/react-elm-components> npm install
npm WARN react-elm-components@1.0.0 requires a peer of react@>=0.14.0 but none was installed.
 job@job-ThinkPad-T440s-Ubuntu ~/D/e/react-elm-components> npm run serve
npm ERR! Linux 4.4.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "serve"
npm ERR! node v4.4.7
npm ERR! npm  v3.10.4

npm ERR! missing script: serve
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/job/Dev/elm/react-elm-components/npm-debug.log
evancz commented 8 years ago

Can you work through this with someone on the Elm slack? It seems like some npm issue where it's not installing things right, and someone on slack can help work through it better than me.

evancz commented 8 years ago

Not sure how to resolve this without further information. Please reopen if you can pin the problem to something Elm related.

JobLeonard commented 8 years ago

Yeah, my apologies, haven't gotten around to figuring out how to consistently reproduce it. Will re-open if that ever happens.