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

Optimize 'social' plugin on cold load #4546

Closed
wants to merge 4 commits into from
Closed

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Oct 24, 2022

Measuring the build times of 'insiders' docs without cache as follows:
rm -rf .cache/plugin/social && .venv/bin/mkdocs build 2>&1 | grep built
I get these results after each commit (2 measurements each to make it more reliable):

-----before
INFO     -  Documentation built in 8.46 seconds
INFO     -  Documentation built in 8.43 seconds
-----(Optimize social plugin: cache font objects)
INFO     -  Documentation built in 8.40 seconds
INFO     -  Documentation built in 8.42 seconds
-----(Optimize social plugin: reuse resized logo)
INFO     -  Documentation built in 7.78 seconds
INFO     -  Documentation built in 7.79 seconds
-----(Optimize social plugin: cache word width computation)
INFO     -  Documentation built in 7.11 seconds
INFO     -  Documentation built in 7.11 seconds
-----(Optimize social plugin: parallelize image saving)
INFO     -  Documentation built in 5.41 seconds
INFO     -  Documentation built in 5.52 seconds

Build times with cache are not affected.

@squidfunk
Copy link
Owner

Thanks for the PR, this look very promising.

Regarding concurrent.futures – is this Python 3.7+ compatible? That's our current minimum version:
https://github.com/squidfunk/mkdocs-material/blob/master/pyproject.toml#L37

@oprypin
Copy link
Contributor Author

oprypin commented Oct 29, 2022

Sure it's compatible. Always easy to check.
https://docs.python.org/3/library/concurrent.futures.html

New in version 3.2.

@squidfunk
Copy link
Owner

Thanks! Commits were merged into #4628.

@squidfunk squidfunk closed this Nov 12, 2022
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.

None yet

2 participants