Split Frame::new into two.#175
Merged
Merged
Conversation
This function is one of the most frequently called in yksom, so the fact that it serves two different masters (methods and blocks) is less than ideal (at the very least it introduces a branch). This commit splits the function into two, one for methods and one for blocks. To some extent this is a bit pointless in that the major overhead of `Frame::new` is the malloc of a `Vec`, but one day that cost will be much less, so this change seems like a useful one, if perhaps a bit early!
smarr
reviewed
Aug 6, 2020
| self.stack.push(a); | ||
| } | ||
| let frame = Frame::new(self, None, rcv, None, num_vars, meth.num_params()); | ||
| let frame = Frame::new_method(self, rcv, num_vars, meth.num_params()); |
Contributor
There was a problem hiding this comment.
This reads a little strange. If this isn't a Rust-ism, I'd wonder whether Frame::new_for_method/``Frame::new_for_block` or something like it could be just a little more clear.
Member
Author
There was a problem hiding this comment.
It's a bit tricky because from_* has an idiomatic meaning in Rust (which wouldn't really make sense in this case)... Names are hard :/
Contributor
There was a problem hiding this comment.
from_? Do you mean for? Other option new_with_method
Member
|
Looks good. |
Member
|
bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or 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
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.
This function is one of the most frequently called in yksom, so the fact that it serves two different masters (methods and blocks) is less than ideal (at the very least it introduces a branch). This commit splits the function into two, one for methods and one for blocks.
To some extent this is a bit pointless in that the major overhead of
Frame::newis the malloc of aVec, but one day that cost will be much less, so this change seems like a useful one, if perhaps a bit early!This can be reviewed but won't be mergeable until softdevteam/libgc#19 is merged.