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

refactor: better usage of fragment_cache #152

Closed
wants to merge 1 commit into from

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Oct 29, 2019

After have a close look at hexojs/hexo#2164, I have realized something.

Although configuration file (both site's _config.yml and theme's _config.yml) is loaded only once, but the value has to be readed from parsed config (inside Locals) every time when meets in layout. So it is important to wrap config value inside fragment_cache.

I have ran through a benchmark with same setup I used in hexojs/hexo#3663. Before c8d5d16, is takes about 6.16 seconds to generate a site with 300 posts, After c8d5d16, it drops to about 5.9 seconds, which is about 4% less.

This PR is a PoC that we should wrap <%= config.xxx %> or <%= theme.xxx %> inside fragment_cache as much as possible.

@stevenjoezhang
Copy link
Member

Is it ready to merge?

@SukkaW
Copy link
Member Author

SukkaW commented Apr 24, 2024

Fragment Cache is not the best way to do this. We need to use a lower-level of caching.

@SukkaW SukkaW closed this Apr 24, 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