Closed stevenhao closed 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/downforacross/downforacrosscom/bysmd7ti3
✅ Preview: https://downforacrosscom-git-optimize-puzzle-list.downforacross1.vercel.app
Embarassingly, searching the puzzle repo accounts for almost all of the remaining hosting costs of downforacross [after migrating the game events to postgres]. this change should drastically reduce the amount of data being read from firebase.
the entire puzzle list is about 3MB, with ~10000 entries. The algorithm for search often behaves extremely inefficiently, because
In total this means that doing a single search for a keyword like "foobar" will cause the client to download the entire puzzle list 10000 / 40 = 250 times, for a total of 600MB data transferred.
This PR reduces that worst case behavior to ~6MB (100x) by doubling the number of pages loaded every time, resulting in the number of MB being downloaded in successive queries to form a geometric series with sum bounded by ~2x the size of the total repo.