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
Sort static files just once. #3204
Conversation
@gjtorikian can you try this? |
Shaved about forty seconds! I'll take it! |
😮 Wooooow. Can you run stackprof again with this code and see what else is causing the bottleneck? 40 seconds of a 5-min build is a big win, but it shouldn't take more than 1 min to compile the entire site. The sorting should probably also take place after |
@@ -15,6 +17,7 @@ def initialize(site, base, dir, name, collection = nil) | |||
@dir = dir | |||
@name = name | |||
@collection = collection | |||
@relative_path = File.join(*[@dir, @name].compact) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this ever have a nil
value? Just curious about the compact
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if both @dir
and @name
are nil
, then it'd be File.join()
with nothing. It should be theoretically impossible for @name
to be empty, but @dir
can be.
To be clear, here's what's going on in my build:
That's where I discovered this Here are the top three rows from stackprof:
Clear drop-off after Interestingly, that def html_files
@site.static_files.select { |file| File.extname(file.relative_path) == ".html" }
end If I remove this plugin, I gain just a few more seconds. The other one seems to come from site.rb: def documents
collections.reduce(Set.new) do |docs, (_, collection)|
docs + collection.docs + collection.files
end.to_a |
We could cache the extname call for sure... As for the #documents call, how often is it being called itself? |
I think that is what you wanted? 😟 I'm not sure! We can also put this PR on pause and talk IRL. |
WHOA. |
If you saw the site you'd probably weep. That's not such a crazy figure: https://help.github.com/sitemap.xml |
460e377
to
c10c642
Compare
@gjtorikian Thanks for taking the time to check these. Can you try out d10a941? :) |
Wow:
For reference, here's the exact same site--all of it!--using the copy of Jekyll provided by
This is better than fantastic. I can run another stackprof if you like, if you think that'll suss out more perf gains. 😄 |
HOLY MOLY! Ok cool. Yeah another stackprof would be splendid. |
For full disclosure, the benchmark script is simply: time = Benchmark.realtime do
`jekyll build --config=_config.yml,_config.dev.yml`
end Here's the stackprof:
I can pass the file along to you too if it helps. |
That stackprof looks old – can you re-run with the latest code here please? :) Also your benchmark could be full-Ruby: require 'jekyll'
time = Benchmark.realtime do
Jekyll::Commands::Build.process({ "config" => %w[_config.yml _config.dev.yml] })
end |
I LOVE THE PARALLEL GEM IT IS AMAZING
|
Hah. Let me know when you need a rerun. I'll hold off for now. |
✨😮✨ |
Turns out we have to restructure some stuff in order to use |
3beeb56
to
db3eebb
Compare
db3eebb
to
b6641be
Compare
Definitely a gigantic improvement here. Thanks a ton! Running off of
Unfortunately it looks like Liquid-3 is handling tags a bit differently. I know this isn't the right issue for that, but I'm not sure where to post this:
|
This could have to do with the strict parser. If you search for
If these files are |
That would mean that we'd need to work around this change in behavior before releasing Liquid 3 in a Jekyll 2.x version, correct? |
We'd have to have like |
Yeeeeeep, that was it; turning
shrug janl/mustache.js#418 In the meantime, it's just one character. |
Ref: #2075.