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

Make compiled ruby source use frozen string literals #7177

Closed
ledhed2222 opened this issue Feb 6, 2020 · 3 comments
Closed

Make compiled ruby source use frozen string literals #7177

ledhed2222 opened this issue Feb 6, 2020 · 3 comments
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. ruby

Comments

@ledhed2222
Copy link

What language does this apply to?
Applies to ruby generated code

Describe the problem you are trying to solve.
In ruby, string literals are (unfortunately) mutable. This comes with a memory penalty. There is a magic comment you can use at the top of any ruby file to opt-out of this for the file only:

# frozen_string_literal: true

....

I think it would be cool if protoc output ruby in this manner, albeit mostly because this is a best practice. I'd be shocked if this had any real-world performance gains.

As far as I can tell, the protoc compiler never makes use of the theoretical mutability of ruby strings, as it ought not to. Therefore it should not even be an option; all compiled ruby should have mutable strings turned off.

Describe the solution you'd like
Every ruby compiled source file (*_pb.rb) should have the magic comment described above at the top.

Describe alternatives you've considered
N/A

Additional context
I'd be happy to do this if you guys agree :)

@noahmatisoff
Copy link

I made the change in #7888, curious if the protobuf team will want it to be an option when doing codegen however.

@haberman haberman added the ruby label Feb 16, 2021
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Mar 28, 2024
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. ruby
Projects
None yet
Development

No branches or pull requests

3 participants