continued to be amazed by AI coding on divebar.info
I keep adding a lot of SEO stuff, but then i noticed performance was stating to be an issue. I asked the AI programming tool, what can we do to to improve performance?
If you are tech savvy, how does this strike you?
**************output from AI tool*****************************
A few likely culprits and concrete fixes (no code yet — want your pick before I touch anything):
Where the slowness is On a cache MISS the edge function does this serially before returning anything:
Geocode the city (1 Places call)
Up to 3 paginated Places searches (MAX_PAGES = 3, ~1–2s each)
For every unscored bar: fetch reviews (batches of 10)
AI dive-scoring (Gemini, batches of 15)
So a fresh city = ~6–15s. GPS searches are even slower because every coordinate is a unique cache key, so almost every GPS search is a MISS.
High-impact fixes I'd suggest, in order:
1. Stale-while-revalidate — if a cached row exists but is expired, return it instantly and refresh in the background with EdgeRuntime.waitUntil(). Users almost never wait on stale data.
2. Round GPS coordinates to ~3 decimals (~110m) when building the cache key. Right now 37.7749295,-122.4194155 and 37.7749296,-122.4194156 are different cache entries — basically guaranteeing GPS misses.
3. Drop MAX_PAGES from 3 → 1 (20 results instead of 60). For dive search 20 is plenty after filtering, and it cuts the Places latency roughly to a third.
4. Skip the separate geocoding call — pass the city string directly to the main searchText (it already handles location text). Saves one round trip.
5. Pre-warm popular cities with a scheduled function (the cities in your cityLandingPages list) so they're always hot.
6. Frontend perceived perf: show skeleton cards immediately + a "Searching nearby dive bars…" message so the wait feels intentional.
My recommendation: do #1 + #2 + #3 together — biggest wins, smallest blast radius. Want me to ship those?
Link:
divebar.info
Posted: 05/18/2026 at 11:39 AM ET
Thread Replies (0)
continued to be amazed by AI coding on divebar.info
◄
-- MrBayAreaHokie
May 18, 2026 at 11:39 AM ET
MrBayAreaHokie
•
05/18/26 11:39 AM ET