Skip to content

Add caching to improve mkdocs build time #3223

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cpholguera
Copy link
Collaborator

@cpholguera cpholguera commented Mar 16, 2025

Closes #3224.

This PR adds the lru_cache decorator from the functools library to improve the performance of various functions by caching their results.

Current build time: ~63s

Improved build time: ~50s

Performance improvements:

  • docs/hooks/add-cross-references.py: Added lru_cache to the gather_metadata function to cache its results and improve performance.
  • docs/hooks/create_dynamic_tables.py: Applied lru_cache to several functions including get_platform, get_mastg_tests_dict, retrieve_masvs, get_masvs_groups, get_all_weaknessess, get_all_tests_beta, get_all_demos_beta, and get_all_mitigations_beta to enhance their efficiency.
  • docs/hooks/edit_button_uri.py: Cached the result of the get_edit_url function using lru_cache.
  • docs/hooks/github_api.py: Added lru_cache to the get_latest_successful_run function to cache its results and improve performance.

@cpholguera cpholguera changed the title Add caching to improve performance of metadata gathering functions Add caching to improve mkdocs build time Mar 16, 2025
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.

Improve mkdocs build time
2 participants