Seshat-Global-History-Databank / seshat

Seshat: A groundbreaking resource that is bringing together the most current and comprehensive body of knowledge about human history available.
https://seshat-db.com/
2 stars 0 forks source link

Refactor Seshat variable loading on world map for speed #84

Open edwardchalstrey1 opened 1 month ago

edwardchalstrey1 commented 1 month ago

Role

Developer

Desired Feature

Opening the world map, the variables dropdown is available faster

Benefit

Avoid long wait time for variables to be fully loaded

Acceptance Criteria

All data variables used to colour the World map should be loaded in under one minute

Dependencies

No response

Technical Notes

TODO

Need to figure out if the time the variables functions take to run, or the size of the data in Mb is causing the problem. Almost certainly it will be the latter, otherwise it would also be slower on faster internet connections or when running locally.

edwardchalstrey1 commented 1 month ago

Time before changes implemented (commit 3f173e7).

shapesData Mb Python time (local) Template time (local) Python time (Turing VM) Template time (Turing VM) Template time (CSH VM)
Load of all shapes 111.69 0.52 6.10 3.72 20.42 34.43, 122.74, 32.52
Load of all shapes with vars 187.89 5.87 15.29 8.70 31.72 70.05, 182.29, 120.71

As of commit 60f2ba:

shapesData Mb Python time (local) Template time (local) Python time (Turing VM) Template time (Turing VM) Template time (CSH VM)
Load of all shapes 111.68 0.54 6.01 3.67 20.12 65.85
Load of all shapes with vars 80.12 5.03 9.06 6.63 12.94 39.60

Where VMs are connected to on internet speed of: 13Mbps download (note: in reality this varies a lot)

This suggests the following:

  1. Locally, loading the vars view takes about 3.5X the time of loading without vars
  2. Once you get to the site, the python time is however irrelevant since the vars view is only 2X the time, suggesting the main thing here is just the time it takes to load the shapes all again
  3. So the problems are that the loading 111-188 mb is slow and that we are doing so twice

TODO:

edwardchalstrey1 commented 1 month ago

Even after merging #97 this can still take almost 3 minutes