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

Allow Hash#transform_keys to take a hash argument #2464

Merged
merged 5 commits into from
Oct 21, 2021

Conversation

ccocchi
Copy link
Contributor

@ccocchi ccocchi commented Oct 10, 2021

Hello,

This is part of the Ruby 3.0 support - #2453. I've tested the changes against the ruby/spec suite plus the changes I've added to the suite.

About the implementation, I wasn't sure if the check for the mapping presence should be done within the loop (what I ended up doing) or outside of it, which would make the code more verbose/duplicate.

This is my first contribution to truffleruby, so any feedback is welcome 🙂

@graalvmbot
Copy link
Collaborator

graalvmbot commented Oct 10, 2021

Hello ccocchi, thanks for contributing a PR to our project!

We use the Oracle Contributor Agreement to make the copyright of contributions clear. We don't have a record of you having signed this yet, based on your email address cocchi -(dot)- c -(at)- gmail -(dot)- com. You can sign it at that link.

If you think you've already signed it, please comment below and we'll check.

@eregon
Copy link
Member

eregon commented Oct 11, 2021

Hello, this looks good, thank you for the PR.
Could you sign the OCA (at https://oca.opensource.oracle.com/)?

@eregon eregon mentioned this pull request Oct 11, 2021
82 tasks
@graalvmbot
Copy link
Collaborator

Hello ccocchi, thanks for contributing a PR to our project!

We use the Oracle Contributor Agreement to make the copyright of contributions clear. We don't have a record of you having signed this yet, based on your email address cocchi -(dot)- c -(at)- gmail -(dot)- com. You can sign it at that link.

If you think you've already signed it, please comment below and we'll check.

@eregon
Copy link
Member

eregon commented Oct 11, 2021

Sorry about the duplicate message, it's maybe because I edited the first one to fix the link.

@ccocchi
Copy link
Contributor Author

ccocchi commented Oct 11, 2021

Great! I signed it yesterday, it is still under review.

@eregon
Copy link
Member

eregon commented Oct 12, 2021

The OCA went through, the bot should react soon.

@eregon
Copy link
Member

eregon commented Oct 12, 2021

About the implementation, I wasn't sure if the check for the mapping presence should be done within the loop (what I ended up doing) or outside of it, which would make the code more verbose/duplicate.

I think in this case it would be more readable to have a separate loop, given there are 3 checks for if mapping which could be just 1 if done early. Could you change to that?

Performance-wise, it seems a bit better to have separate loops for the interpreter, and if the method is not split (i.e., the runtime does not create a copy for a call site because e.g. it ran out of split budget).

@graalvmbot
Copy link
Collaborator

ccocchi has signed the Oracle Contributor Agreement (based on email address cocchi -(dot)- c -(at)- gmail -(dot)- com) so can contribute to this repository.

@ccocchi
Copy link
Contributor Author

ccocchi commented Oct 13, 2021

I think in this case it would be more readable to have a separate loop, given there are 3 checks for if mapping which could be just 1 if done early. Could you change to that?

Changes are done 🙂

Out of curiosity, did you use any tool (like seafoam or other) to determine the performance difference or simply used your overall knowledge about how the interpreter will handle that case?

@eregon
Copy link
Member

eregon commented Oct 14, 2021

Out of curiosity, did you use any tool (like seafoam or other) to determine the performance difference or simply used your overall knowledge about how the interpreter will handle that case?

In this case my overall knowledge.

@eregon
Copy link
Member

eregon commented Oct 14, 2021

Thanks for the changes, I'll add a CHANGELOG entry and I'll figure out if I add the spec to :next or if I bump the RUBY_VERSION before.

@eregon eregon self-assigned this Oct 14, 2021
@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Oct 18, 2021
* It is reliable now.
@eregon eregon added this to the 22.0.0 milestone Oct 21, 2021
@graalvmbot graalvmbot merged commit 9541ed8 into oracle:master Oct 21, 2021
@ccocchi ccocchi deleted the transform_keys branch October 24, 2021 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. oca-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants