covid19india-cluster
covid19india-cluster copied to clipboard
Shift rowsToGraph function to a Zeit Now serverless function
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?
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.
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.
Maybe a spinner can help to have a better UX.
https://github.com/someshkar/covid19india-cluster/issues/141 Better solution.
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.