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

Avoid excessive splitting of nodes caused by a unique proc being created per call when a method reference would suffice. #3529

Merged

Conversation

nirvdrum
Copy link
Collaborator

Truffle::Splitter.split will yield each split part if a block is provided or otherwise will collect the results into an array. These code paths were unified by creating a proc to Array#<<. This approach resulted in a new proc being allocated per call, which in turn created excessive splitting of Array#<< as reported in #3527. Since the method reference can be invoked directly, there's no need to turn it into a proc. This PR simplifies the code to eliminate that proc allocation.

…ted per call when a method reference would suffice.
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 12, 2024
@andrykonchin andrykonchin added the in-ci The PR is being tested in CI. Do not push new commits. label Apr 12, 2024
@andrykonchin andrykonchin force-pushed the reduce-proc-allocation-string-split branch from 70c1051 to 2d0171e Compare April 12, 2024 14:50
@graalvmbot graalvmbot merged commit dc120e7 into oracle:master Apr 12, 2024
14 checks passed
@eregon eregon linked an issue Apr 17, 2024 that may be closed by this pull request
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 Verified All contributors have signed the Oracle Contributor Agreement. performance shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excessive splitting with Method#to_proc
4 participants