Skip to content

[Perf]: Optimize what's happening section rendering - #3449

Open
lvachon1 wants to merge 3 commits into
mainfrom
lev/perf/whats_happening
Open

[Perf]: Optimize what's happening section rendering#3449
lvachon1 wants to merge 3 commits into
mainfrom
lev/perf/whats_happening

Conversation

@lvachon1

Copy link
Copy Markdown
Contributor

Scope

Asana Ticket: 📈 Optimize what's happening section rendering

Implementation

Added a cache to page_controller.whats_happening_items/0 since the URL encoding inside was a bit slow. I first tried only escaping the content parameter and just concatenating the rest, but that didn't make much difference. So I'm back to using my favorite new hammer: function caches.

There was a cache already in the CMS repo for the data that supplies this function, but I don't like the idea of stacked caches. I can imagine a race condition that makes us wait 2*@TTL for an update, so I removed the Repo cache for whats_happening(). This way the cache will contain the final output instead of the data to calculate it.

Summary: Execution time went from ~6000us to ~180us in exchange for about 3k of memory (probably less, since I got rid of the Repo cache).

Let me know if I'm using my shiny new cache hammers too often on all these performance nails I see.

Screenshots

Main Whats Happening

Main_WhatsHappening

Branch Whats Happening (aka a cache hit)

Branch_WH

How to test

http://localhost:4001/?locale=en - Confirm that the What's Happening section still shows up, no change should be visible except speed. You (probably) have to be on VPN for the CMS to work, at least that's how my setup is configured.

…vel and added a cache to page_controller.split_add_utm_url
…ller.whats_happening_items(). Removed the cache decorations from other functions in this chain.
@lvachon1
lvachon1 marked this pull request as ready for review August 26, 2026 14:15
@lvachon1
lvachon1 requested review from a team and amaisano as code owners August 26, 2026 14:15
@lvachon1
lvachon1 requested a review from joshlarson August 26, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant