[Perf]: Optimize what's happening section rendering - #3449
Open
lvachon1 wants to merge 3 commits into
Open
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Asana Ticket: 📈 Optimize what's happening section rendering
Implementation
Added a cache to
page_controller.whats_happening_items/0since 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*@TTLfor an update, so I removed the Repo cache forwhats_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
Branch Whats Happening (aka a cache hit)
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.