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

Resolver performance optimizations + optional local caching for better re-run performance #72

Merged
merged 18 commits into from
Oct 5, 2022

Conversation

vickygos
Copy link
Contributor

@vickygos vickygos commented Oct 4, 2022

Goal

  • To Enable quicker iteration of OpenRarity scoring algorithm changes
  • To enable quicker individual runs of resolver

Changes

  • Added in optional caching whenever we fetch data from external API's (opensea for trait data, and external ranking providers) by storing the fetched data in local json files used for reading in subsequent runs. This allows re-runs to be lightning fast as they do not require re-fetching of data through API's as they tend to be static, especially in the short-term.
    • It also means that users with trait or ranking data in their own databases can use that by following the same json cache format, thus avoiding API calls.
  • Optimized resolver so that we bulk fetch all opensea tokens prior to fetching external resolver ranking data.
    • This allows us to have higher batch limits for external resolvers (like traitsniper, batch = 300), even though opensea API limits are 30.
  • Sample BAYC trait data json cache file to memoize opensea API calls.

Unlocks

  • If we are testing various algorithm changes, and want to get the diffs csv from resolver, we can use the default cache field to avoid external API calls in subsequent runs.

@vickygos vickygos changed the title [Draft] Memoize all external API calls for better performance for re-runs [Draft] Resolver performance optimizations + optional local caching for better re-run performance Oct 4, 2022
@vickygos vickygos changed the title [Draft] Resolver performance optimizations + optional local caching for better re-run performance Resolver performance optimizations + optional local caching for better re-run performance Oct 4, 2022
@theelderbeever
Copy link
Collaborator

As a pattern maybe make a .cache directory and then just gitignore .cache? That way it isn't file type dependent and doesn't show up in the repo?

@vickygos vickygos merged commit a643f52 into main Oct 5, 2022
@vickygos vickygos deleted the vicky/memoize_external_api_data branch October 5, 2022 18:04
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.

4 participants