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

Lazy default for Option.getOrElse/Coll.getOrElse #798

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

SethDusek
Copy link
Collaborator

@SethDusek SethDusek commented Dec 28, 2024

Add lazy default for getOrElse and Coll.get, also transpose Box<Option> so Option<Box> to make pattern-matching simpler and avoid allocating for None
For #787

@coveralls
Copy link

coveralls commented Dec 28, 2024

Pull Request Test Coverage Report for Build 12611199821

Details

  • 38 of 48 (79.17%) changed or added relevant lines in 11 files are covered.
  • 10 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.008%) to 78.453%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ergotree-interpreter/src/eval/coll_by_index.rs 6 7 85.71%
ergotree-interpreter/src/eval/extract_reg_as.rs 1 2 50.0%
ergotree-interpreter/src/eval/option_get.rs 1 2 50.0%
ergotree-interpreter/src/eval/sbox.rs 1 2 50.0%
ergotree-ir/src/mir/value.rs 4 5 80.0%
ergotree-ir/src/mir/constant.rs 2 7 28.57%
Files with Coverage Reduction New Missed Lines %
ergotree-ir/src/serialization/types.rs 10 80.42%
Totals Coverage Status
Change from base Build 12589822362: -0.008%
Covered Lines: 11076
Relevant Lines: 14118

💛 - Coveralls

sigma-rust stores optional values as Box<Option<Value>>, which is less efficient than Option<Box<T>>, since it allocates just to represent the None case and doesn't benefit from niche optimization
@SethDusek SethDusek marked this pull request as ready for review January 4, 2025 14:36
@SethDusek SethDusek requested a review from kushti January 4, 2025 14:43
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