Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add caching to speed up BoxScore loading #562

Closed
wants to merge 2 commits into from

Conversation

DesiPilla
Copy link
Contributor

A very small PR to make the repo a bit faster in one use case. The .box_score() method can take ~1.5s on average to load, making it very slow if your code iterates over this many times. Adding this cache makes it easier to work with and orders of magnitude faster.

the `.box_score()` method can take ~1.5s on average to load, making it very slow if your code iterates over this many times. Adding this cache makes it easier to work with and orders of magnitude faster.
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.34%. Comparing base (1bcfdbf) to head (25c7a5b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #562      +/-   ##
==========================================
+ Coverage   84.32%   84.34%   +0.01%     
==========================================
  Files          60       60              
  Lines        2227     2229       +2     
==========================================
+ Hits         1878     1880       +2     
  Misses        349      349              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkirby528
Copy link

@DesiPilla dumb question , but wouldn't this mean that it doesn't fetch the latest score (and wouldn't have live updates?). Ie if the score has changed since you last called the function you would get a stale result?

@DesiPilla
Copy link
Contributor Author

@mkirby528 This is true.

I guess, as a default, this function has more use-cases for live score changes. My use case in particular is not, and I can manually overload the function to cache.

@mkirby528
Copy link

Yeah totally get where you are coming from, but was wanting to make sure this doesn't break my usecase where im using it to display the live scores of all my games

@DesiPilla DesiPilla closed this Sep 4, 2024
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.

2 participants