covid19india-cluster icon indicating copy to clipboard operation
covid19india-cluster copied to clipboard

Shift rowsToGraph function to a Zeit Now serverless function

Open someshkar opened this issue 4 years ago • 5 comments

As the number of patients increases, the time taken to calculate the positions of their nodes also linearly scales. As such, with every passing day, new patients get added, making the cluster graph proportionally less performant.

What makes the most sense to me right now is shifting as many calculation-heavy functions(like the rowsToGraph function) to the backend (i.e. Zeit Now serverless functions) as possible. We can make these available as APIs to the react frontend. This should help reduce load times and improve performance. Thoughts?

someshkar avatar Mar 27 '20 14:03 someshkar

Problem with this is that just shifting to server won't reduce lag. Lag is due to too many elements on the canvas, not due to the speed at which rowToGraph function is working.

sibeshkar avatar Mar 27 '20 15:03 sibeshkar

There are a lot of nodes with no edges. If the main concern of this is to find the clusters then why not remove such nodes in p2p.

Similarly in foreign history, nodes with no foreign history can be removed.

gotham13 avatar Mar 27 '20 17:03 gotham13

Maybe a spinner can help to have a better UX.

shubh0107 avatar Mar 28 '20 08:03 shubh0107

https://github.com/someshkar/covid19india-cluster/issues/141 Better solution.

sibeshkar avatar Mar 28 '20 11:03 sibeshkar

Can we also not show all the nodes of a given cluster and instead show it as a big node. The bigger the cluster the bigger the node and clicking on that node will expand it and show individual patients. This is not a very big performance improvement but as the size grows, this will definitely prevent crashings on phones.

lordozb avatar Mar 28 '20 18:03 lordozb