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

Add frozen_string_literal magic comment #1408

Merged
merged 1 commit into from
Sep 18, 2023
Merged

Conversation

yawboakye
Copy link
Contributor

Adopting the almost ubiquitous frozen_string_literal magic comment to ensure efficient string storage. I observed that we don't mutate any of the string literals after we have declared them which implies that, in essence, they're already treated as frozen values. Invoking the magic comment is only a clue to the Ruby VM to optimize the strings.

Closes #1407.

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.

Test Plan:

All existing tests pass.

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

for efficient string storage since we don't mutate any of the string
literals after they have been declared. in essence, they're already
being used as frozen values.
@lgebhardt lgebhardt merged commit a2e8ad5 into cerebris:master Sep 18, 2023
nginz pushed a commit to nginz/jsonapi-resources that referenced this pull request Dec 21, 2023
for efficient string storage since we don't mutate any of the string
literals after they have been declared. in essence, they're already
being used as frozen values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt the frozen_string_literal magic comment to optimize string storage
2 participants