Open dylanilvento opened 4 years ago
I'm unsure if these are both valid syntax.
The syntax using null
is the invalid one. However, Hexo could handle the null
locals so it won't be a problem (But still, not recommended)
Normally 300 posts should only use less than 20 seconds for generation. You can switch the theme back to default hexo-theme-landscape
and see if there is any performance improvements. If not, then try uninstalling multiple-podcast
plugin.
Also, you could run hexo clean && hexo g --debug
and paste the output at https://paste.ubuntu.com . Under debug
mode (which will log more details) it will be easier to find out where hexo is stuck at.
I ran a hexo clean && hexo g --debug
for part of it. Here's the output.
It seems the generation process slows way down when it hits the podcast art files, which are unique images for each episode that are read into the RSS. They're 2200 x 2200 px in dimension but are only ~3MB at their largest. I'm thinking that maybe burning it into the RSS takes a significant amount of time — each one of these images alone is taking ~10 seconds to process.
I'll try removing these images and seeing that improves the speed.
Alright, after deleting and shrinking some of these larger image files, I tried another generate build, and, similar to the previous one, it really started to hang after a minute or two of processing. I let it run for a bit and the debug prompt finally gave me this:
This is the first podcast file it processed, and it took a solid seven minutes to do so. The kicker is that this audio file, clocking in at about 8 minutes and ~10 MB, is probably the smallest audio file on the site. The average size for most of my podcasts is about an hour or two in length and 100 to 200 MB in size. So if the processing time is basically one-to-one to the length of the podcast, having the files in the project when I run a generate
command isn't feasible.
This isn't especially deal-breaking since I can probably figure out some way to automate re-adding the audio files whenever I need to do a new build. But I'm really curious why it would take so long to process these files. I was under the impression that the generate
command, when it came image and audio files, was simply moving them to a different directory. But if that's not the case, I'm wonder what sort of processing these files would need to be prepared for the site's generation.
Either way, I'll try removing those files to see what it does, but my guess is that it's going to significantly shrink the processing time for the build.
@stevenjoezhang @hexojs/core @dailyrandomphoto
I have read the code recently. It appears that Hexo will process every file under source_dir
into a File
class. And all current feature we have just won't solve the issue:
include
: It is only used for forcing hidden files/tmp files be rendered into public
exclude
: It is only used for prevent the file being into public
skip_render
: It only prevent file being transformed, not stop file being processed.We should implement a feature, to only copy the static file (without process & render) into public
directly.
Check List
Please check followings before submitting a new issue.
hexo version
to check)Actual behavior
I'm using hexo with a custom theme that I've built myself. In the past,
generate
andserver
times were manageable, but recently runninghexo server
can take upwards of 1 to 2 hours of processing time before I can view the site on localhost.I know there can be several causes for this: number of posts on the site, number of tags used, not implementing the fragment_cache helper (or using the cache argument in partials), switch to a different markdown renderer to improve performance, making sure you're running hexo 4.0 or newer — but addressing these concerns do not seem to alleviate the problem I'm having.
My site has about 300 posts, most of them for one of my two podcasts, which use the
hexo-generator-multiple-podcast
plugin to generate the corresponding RSS-valid XML file via tags. I have about 60 tags total, with only two of them being used for RSS. I'm unsure if the podcast plugin is also contributing to the processing time. You can see the repo for my dev branch, as well as all of my attempts to improve the situation here: https://github.com/dylanilvento/wardsite/tree/developAfter reading about how hexo uses only one core to run these processes, I recently stumbled upon the
fragment_cache
helper that helps with processing. Looking up how to implement it took a second, and I'm still not sure if I've coded it properly since some examples use<%- partial('_partial/partial-example', null, {cache: true}) %>
while others use
<%- partial('_partial/partial-example', {}, {cache: true}) %>
and I'm unsure if these are both valid syntax.
Other references to caching in hexo also mention enabling it in a config file somewhere, but are unclear which config file or what the syntax looks like. I found one example where you should add this to the root
_config.yml
file:But that did not seem to fix it either.
I'd appreciate any help on what I may be missing.
Environment & Settings
Node.js & npm version
node: v10.15.3
npm: v6.4.1
Your site
_config.yml
(Optional)Your theme
_config.yml
(Optional)(This file is empty.)
Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others