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

Add missing methods to Smt #268

Merged
merged 7 commits into from
Jan 30, 2024
Merged

Add missing methods to Smt #268

merged 7 commits into from
Jan 30, 2024

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Jan 30, 2024

Closes #250

@plafer plafer requested a review from bobbinth January 30, 2024 20:05
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good! I think the approach works but I left some comments about reducing potential cloning/allocations.

Comment on lines 323 to 329
for (key_in_leaf, value_in_leaf) in self.entries() {
if key == key_in_leaf {
return *value_in_leaf;
}
}

EMPTY_WORD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the compiler can optimize this away, but I'd prefer to handle it using a match statement to avoid potential unnecessary allocations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 119 to 121
let leaf = self.get_leaf(key);

leaf.get_value(key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as above: this may result in closing of the leaf first and then getting a value from it. May be better to make sure we don't rely on the compiler for optimizing away unnecessary cloning/allocations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link

sonarcloud bot commented Jan 30, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@bobbinth bobbinth merged commit 69fd415 into next Jan 30, 2024
10 checks passed
@bobbinth bobbinth deleted the plafer-smt-get-value branch January 30, 2024 21:47
@bobbinth bobbinth mentioned this pull request Jan 30, 2024
bobbinth pushed a commit that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants