We want to make the website faster. Before thinking about caching, one thing we can do is reduce the payload that we are requesting from AirTable.
This PR
Rather than requesting data from all hospitals at once, this PR queries AirTable by each city instead.
Performance Measurement
Methodology
By inserting time.time() calls before and after each request, we can time how long it's taking for our server to respond to requests to /government_paid_hospitals.
Context
This PR
Performance Measurement
Methodology
By inserting
time.time()
calls before and after each request, we can time how long it's taking for our server to respond to requests to/government_paid_hospitals
.Time (seconds)
Total request response time improvement: 13.59-4.17 = 9.42 seconds. (3.25x speedup)
Test Plan
[X] yarn lint, yarn tc and yarn test are passing
[X] Website loads successfully.
[X] Website can switch between cities
https://user-images.githubusercontent.com/8745371/126029568-e06820be-36a1-4cb1-a3cf-283b82f2c607.mp4
https://user-images.githubusercontent.com/8745371/126029606-40ba0e7b-5c50-4894-83a7-aef7d461a588.mp4