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
Ruby: Improve performance of flow through (hash) splats #14229
Draft
hvitved
wants to merge
12
commits into
github:main
Choose a base branch
from
hvitved:ruby/splat-flow-performance
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ad1d9a3
to
46cf10b
Compare
| @@ -887,7 +887,9 @@ | |||
| or | |||
| implicitCallEdge(pred, succ) | |||
| or | |||
| exists(DataFlow::HashLiteralNode splat | hashSplatEdge(splat, pred, succ)) | |||
| exists(DataFlow::HashLiteralNode literal | hashSplatEdge(literal, pred, succ)) | |||
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
This exists variable can be omitted by using a don't-care expression .
in this argument
Error loading related location
| exists(DataFlow::HashLiteralNode splat | hashSplatEdge(splat, pred, succ)) | ||
| exists(DataFlow::HashLiteralNode literal | hashSplatEdge(literal, pred, succ)) | ||
| or | ||
| exists(DataFlow::ArrayLiteralNode literal | splatEdge(literal, pred, succ)) |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
This exists variable can be omitted by using a don't-care expression .
in this argument
Error loading related location
f582dbd
to
5ae4441
Compare
5ae4441
to
d4fb553
Compare
Allow flow from a splat argument to a positional parameter in cases
where there are positional arguments left of the splat. For example:
def foo(x, y, z); end
foo(1, *[2, 3])
In cases such as
def f(x, *y); end
f(*[1, 2])
we don't need any `SynthSplatArgumentElementNodes`. We get flow from the
splat argument to a `SynthSplatParameterNode` via `parameterMatch`, then
from element 0 of the synth splat to the positional param `x` via a
read step.
We add a read step from element 1 to `SynthSplatParameterElementNode(1)`.
From there we get flow to element 0 of `*y` via an existing store step.
- Only step through a `SynthSplatParameterElementNode` when there is a splat parameter at index > 0. - Model read+stores via `SynthSplatArgumentElementNode` as a single read-store step in type tracking.
d4fb553
to
d9751d2
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.