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

Enforce Style/FrozenStringLiteralComment #6265

Merged
merged 1 commit into from Aug 4, 2017

Conversation

Projects
None yet
4 participants
@parkr
Member

parkr commented Aug 3, 2017

The frozen_string_literal: true magic comment in Ruby can help
dramatically decrease memory allocations for new strings and can thusly
speed up your program. The intent here is for Jekyll to use less memory
and make fewer memory allocations (which must later be GC'd).

Using the output of GC.stats from script/stackprof:

Before:

total_allocated_pages: 67284
total_allocated_objects: 27434203
total_freed_objects: 23567

After:

total_allocated_pages: 63008
total_allocated_objects: 25690804
total_freed_objects: 22907

With this patch, we allocate 4,276 fewer pages, and 1,743,399 fewer objects. Holy smokes! That's huge savings.

/cc @jekyll/stability

@jekyllbot jekyllbot assigned parkr and oe Aug 3, 2017

@parkr parkr requested review from pathawks and mattr- Aug 3, 2017

@pathawks

A couple comments, but I'm totally on board with this change 👍

@@ -27,7 +27,7 @@ note: This file is autogenerated. Edit /History.markdown instead.
- add plugins for multiple page pagination ([#6055]({{ site.repository }}/issues/6055))
- Update minimum Ruby version in installation.md ([#6164]({{ site.repository }}/issues/6164))
- [docs] Add information about finding a collection in `site.collections` ([#6165]({{ site.repository }}/issues/6165))
- Add {%raw%} to Liquid example on site ([#6179]({{ site.repository }}/issues/6179))
- Add {% raw %}`{% raw %}`{% endraw %} to Liquid example on site ([#6179]({{ site.repository }}/issues/6179))

This comment has been minimized.

@pathawks

pathawks Aug 4, 2017

Member

This probably doesn't belong in this PR
?

exe/jekyll Outdated
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#

This comment has been minimized.

@pathawks

pathawks Aug 4, 2017

Member

This should probably be an empty line

@@ -744,7 +759,7 @@ text/x-fortran f for
text/x-handlebars-template hbs
text/x-java-source java
text/x-lua lua
text/x-markdown markdown md mkd
text/x-markdown mkd

This comment has been minimized.

@pathawks

pathawks Aug 4, 2017

Member

Mime type stuff probably doesn't belong in this PR
?

Enforce Style/FrozenStringLiteralComment.
The frozen_string_literal: true magic comment in Ruby can help
dramatically decrease memory allocations for new strings and can thusly
speed up your program. The intent here is for Jekyll to use less memory
and make fewer memory allocations (which must later be GC'd).
@parkr

This comment has been minimized.

Member

parkr commented Aug 4, 2017

Updated, thanks for the review @pathawks!

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit 7cf5f51 into master Aug 4, 2017

1 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jekyllbot jekyllbot added bug fix labels Aug 4, 2017

@jekyllbot jekyllbot deleted the frozen-string-literal branch Aug 4, 2017

jekyllbot added a commit that referenced this pull request Aug 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment