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

Enable caching of compiled Jinja templates #3202

Closed
wants to merge 1 commit into from
Closed

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Apr 30, 2023

This should reduce startup times a bit.

This should reduce startup times a bit.
@ultrabug
Copy link
Member

ultrabug commented May 1, 2023

This idea is cool and I already feel like it could benefit multi-language builds such as when used with the mkdocs-static-i18n tho I'd have to check.

While the FileSystemBytecodeCache implements a clear() method but it is not called by default which means that we leave potentially sensible templating information in the /tmp directory of users after a build.

I'm unsure about where we should trigger a clear() to still allow users to benefit from caching but I'm under the impression that we should allow users to opt in or out this feature as well.

@oprypin
Copy link
Contributor Author

oprypin commented May 1, 2023

The only point of this cache is to persist across invocations. If it is cleaned up on exit, that's the same as not having it

@ultrabug
Copy link
Member

ultrabug commented May 1, 2023

My point is that multi-build users could benefit from this while still clearing the cache at the very end (if we make it possible / tunable)

@oprypin
Copy link
Contributor Author

oprypin commented May 2, 2023

True, but that can also be achieved without writing anything to disk and instead just preserving the jinja2.Environment object.
Yeah worth thinking

@oprypin oprypin marked this pull request as draft September 13, 2023 19:24
@oprypin oprypin closed this Apr 21, 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.

None yet

2 participants