Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Cache interpolator methods and reduce memory allocations - rebased - #2054

Closed
dgynn wants to merge 8 commits into
thoughtbot:masterfrom
dgynn:pr_interpolations_tuning_master
Closed

Cache interpolator methods and reduce memory allocations - rebased#2054
dgynn wants to merge 8 commits into
thoughtbot:masterfrom
dgynn:pr_interpolations_tuning_master

Conversation

@dgynn

@dgynn dgynn commented Nov 16, 2015

Copy link
Copy Markdown
Contributor

This is a rebased PR of #1888 in case that one does not merge cleanly to master (although it should).

dgynn and others added 8 commits November 16, 2015 10:58
by using the attachment name (symbol) and Class as keys we reduce the number of Strings created before hitting the cache
this commit primarily uses frozen strings to reduce object creation during interpolation.
the :basename method now uses File.basename(file, ".*") rather than a Regexp. basename may be called multiple times.
the name string is used multiple times in interpolation so storing it reduces object creation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@dgynn

dgynn commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

Closing since v4.3 was merged in directly.

@dgynn dgynn closed this Nov 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants