cosmic-pi-deprecated / cosmicpi-rpi_V1.5

Our web interface and data collection software for Raspberry Pi
Other
4 stars 5 forks source link

Optimise Raspberry Pi code for execution on PiZeroW #15

Closed pingud98 closed 6 years ago

pingud98 commented 6 years ago

The overhead (web, especially) is rather large. We need to make it smaller so that it runs better.

heborras commented 6 years ago

My personal suggestion would be to move the plotting to client side. I can add a function to return the content of the bins of the histogram as json data rather than as an image. Only doing the binning for the histogram is a lot faster than actually plotting it.

lukicdarkoo commented 6 years ago

Here is a current status on this issue: https://www.youtube.com/watch?v=SOTnAVO8Ifo

The new UI is also fixing #7 and #12

heborras commented 6 years ago

Looks very nice! It's just way better than the current one, where I had basically forcefully ported the old UI to flask ^^

How do you get the data in the histogram on the dashboard? Other comments would be: Axis descriptions on the dashboard histogram and bin setting on the science page, but those are minor things. Which I think we can approach when this issue is resolved.

P.S.: I shortly skimmed over the code and it looks good! But I would like to take a closer look when I have more time.

lukicdarkoo commented 6 years ago

UI periodically gets data from REST (which takes data from database). I noticed that database wasn't that slow, but the piece of code that generates the histogram.

Moreover, UI can even be faster if data is not pulled from the database but directly pushed from cosmicpi-detector to UI. On the first UI load, data should be loaded from the database (to initialize the graph) and afterwards pushed to UI via WebSocket. The architecture is ready for WebSocket implementation, but I believe it is not a priority now.

You are right, I missed that. Done in 7e8ac44078df1a03875fb1f2f8354a48084a9925 and 87f486c770c4156756218fc8bc6def00188c8324.

lukicdarkoo commented 6 years ago

UI is now lighting fast :) Please check https://github.com/CosmicPi/cosmicpi-rpi_V1.5/issues/16#issuecomment-390787347 for details.