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
Performance: Sort files only once #3707
Conversation
👍 |
👍 What's the performance improvement you're seeing with this? |
@@ -15,10 +15,18 @@ def initialize(site) | |||
def read | |||
@site.layouts = LayoutReader.new(site).read | |||
read_directories | |||
sort_files |
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.
sort_files!
?
not crazy much.. about 500ms of ~5s (for initial build and for each regeneration cycle) on a site with about 6000 files. but I guess you have to start somewhere :-) |
Pending responses it'll merge! |
Updated: Renamed the method |
Performance: Sort files only once
Would you mind releasing a beta5 release to Rubygems? |
It'll happen sometime in the next few days because I have a few more changes I would like to get into beta5 (aside from our new JRuby support.) Like thread pooling and possibly even collection fixes. |
If you need though I can cut a new release of our master image for Docker. |
Why not just call those beta6, @envygeeks? |
Fixes #3705.
Turns out the reason that it was slow for me was not that it was sorting at all but that it was sorting the same list of files over and over again.
Solution: Sort only once at the end of
#read
, not every time we load more files from a directory (those functions are called recursively via#read_directories
). This also ensures backwards compatibility for the regular code path (unless you have a plugin that directly calls#retrieve_posts
etc. or stuff like that).@envygeeks @parkr @alfredxing