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

Reduce Jekyll::Renderer instances during a build #7570

Merged
merged 5 commits into from Apr 13, 2020

Conversation

ashmaroli
Copy link
Member

  • This is an 🙋 enhancement.

Summary

This change reduces the number of Jekyll::Renderer instances by half

Jekyll::Renderer is initialized at following places in Jekyll Core:

def _renderer
@_renderer ||= Jekyll::Renderer.new(site, self)
end

def output_ext
@output_ext ||= Jekyll::Renderer.new(site, self).output_ext
end

jekyll/lib/jekyll/site.rb

Lines 516 to 521 in bdbf351

def render_regenerated(document, payload)
return unless regenerator.regenerate?(document)
document.output = Jekyll::Renderer.new(self, document, payload).run
document.trigger_hooks(:post_render)
end

In other words, a Renderer instance is created twice for every Page or Document instance — Once instance to get the renderer's attributes and the other instance to render the document.

@jekyll jekyll deleted a comment from update-docs bot Mar 14, 2019
@ashmaroli ashmaroli requested a review from a team March 14, 2019 17:05
@mattr- mattr- added this to To do in Jekyll 4.1 Mar 25, 2019
@mattr- mattr- moved this from To do to In progress in Jekyll 4.1 Mar 25, 2019
@ashmaroli ashmaroli added this to the 4.1 milestone May 3, 2019
@DirtyF DirtyF added the internal label Aug 4, 2019
@DirtyF DirtyF added this to In progress in Jekyll 4.1 Aug 14, 2019
@DirtyF DirtyF moved this from In progress to Reviewable in Jekyll 4.1 Aug 14, 2019
Copy link
Member

@DirtyF DirtyF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DirtyF DirtyF moved this from In progress to In Review in Jekyll 4.1 Mar 17, 2020
@mattr-
Copy link
Member

mattr- commented Apr 13, 2020

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit e42c35c into jekyll:master Apr 13, 2020
Jekyll 4.1 automation moved this from Reviewable to Done Apr 13, 2020
Jekyll 4.1 automation moved this from In Review to Done Apr 13, 2020
jekyllbot added a commit that referenced this pull request Apr 13, 2020
@ashmaroli ashmaroli deleted the reduce-renderer-instances branch April 13, 2020 07:01
@jekyll jekyll locked and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Jekyll 4.1
  
Done
Jekyll 4.1
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants