arnav-t / riot-embedded

Embedded version of Riot
62 stars 19 forks source link

Resource consumptions (CPU load) #42

Open glunardi opened 3 years ago

glunardi commented 3 years ago

Thank you for the great project! Considering using it to embedded some Matrix rooms into BigBlueButton (BBB) for a conference in a few weeks time. If not mistaken the KDE community tried to do the same last year.

Initial testing shows that with minimal customizations (which we would be happy to propose here for consideration) it might be a viable option for us.

My main concern at present, with the limited testing I have done, is resource utilization. Accessing riot-embedded from Chrome 91 on Linux seems to require a lot of CPU to run the application in the browser.

Is this something you are aware of?

Combining riot-embedded's load with BBB's might just be too much for some of our users with slow laptops or Chromebooks for example.

arnav-t commented 3 years ago

Hello Guy,

Thank you for the feedback. I wasn't aware of any such bottleneck and didn't notice any excess CPU usage on my browser. Can you mention the steps to replicate or test this?

Thanks

glunardi commented 3 years ago

Thank you for your reply.

So far my testing has only been by serving up the webpack using npm start directly.

Even without entering credentials (need to prepare guest accounts for testing), you can see the usage by just visiting: http://45.79.131.203:9000/

Just visit that url and staying on the modal login dialog, you can see that the web app is using quite a bit of resources.

Sadly I have not found time to look into it further but really hope we can make use of riot-embedded for our conference. That would be great.

0xCA commented 7 months ago

I profiled it a little. The culprit is spamming Window.postMessage. Take a look at https://github.com/arnav-t/riot-embedded/blob/master/classes/message-handler.js. You handle a message, and then create a new one, which leads to another handling... Also, having a "*" targetOrigin is a bad practice