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

Major performance issues #2164

Closed
pronvit opened this issue Sep 15, 2016 · 3 comments
Closed

Major performance issues #2164

pronvit opened this issue Sep 15, 2016 · 3 comments
Labels
enhancement New feature or request #perfmatters

Comments

@pronvit
Copy link

pronvit commented Sep 15, 2016

Trying to investigate why Hexo is so slow, I found an interesting thing. Hexo always renders ALL files, even if no files are changed, and then rendering result for unchanged files is discarded.

Moreover, when rendering each file, it loads ejs templates and partials from the theme again and binds all the helpers, i.e. no template caching exists.

For example, for my not very bid site these two problems together lead to various ejs templates being processed 4500+ times and helpers being bound (

locals[key] = _.bind(helpers[key], locals);
) 217000+ times (!) - always, even if no files are changed.

Any comments on this and plans to fix?

@leesei
Copy link
Member

leesei commented Jun 12, 2017

Thanks for your effort in pointing out the bottlenecks.
Indeed Hexo's rendering pipeline can be improved. Yet without documentation of how it works it's hard to have an overall optimization.

That said, Hexo do have fragment_cache. But some themes are not using it properly.

@SukkaW
Copy link
Member

SukkaW commented Dec 3, 2019

For a layout for article page, there might be only one partial but it will be used to render a lot of posts. Those posts have different locals. The layout itself may not change at all, but your post content or your config, which will affect locals, might change.

In order to use hexo's built-in helpers in the theme layout, all those helpers have to bind on each locals.

@stevenjoezhang
Copy link
Member

I will close this issue because the cache is controlled by the Hexo theme. The theme developer decides which rendered content is cached and reused. For example, if every page has the same footer element, then the footer should be rendered faster using fragment_cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request #perfmatters
Projects
None yet
Development

No branches or pull requests

5 participants