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

[refactorings] Leftovers (pot-pourri?) #184

Merged
merged 8 commits into from
Jun 19, 2023

Conversation

huitseeker
Copy link
Contributor

I didn't quite have a place to put those as I was reading / refactoring other bits: opinions on those loosely held, happy to adjust.

The commit are tailored to be independent, and the individual commit messages are meant to be informative.

No serious effect on benchmarks, one way or another:
https://gist.github.com/huitseeker/93c66fda2f8444870e9374da990de541

- Improve path concatenation by utilizing built-in `join` method
- Derive `PartialEq` for `SatisfyingAssignment` struct
- Remove redundant manual implementation of `PartialEq`

Cargo-expand generates:
```
        #[automatically_derived]
        impl<G: ::core::cmp::PartialEq + Group> ::core::cmp::PartialEq
        for SatisfyingAssignment<G>
        where
            G::Scalar: PrimeField,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
        {
            #[inline]
            fn eq(&self, other: &SatisfyingAssignment<G>) -> bool {
                self.a_aux_density == other.a_aux_density
                    && self.b_input_density == other.b_input_density
                    && self.b_aux_density == other.b_aux_density && self.a == other.a
                    && self.b == other.b && self.c == other.c
                    && self.input_assignment == other.input_assignment
                    && self.aux_assignment == other.aux_assignment
            }
        }
```
- Simplify code by replacing `fold` with `sum` in various instances
- Update parameter types to use references instead of owned values in various functions that do not need them
- Replace cloning instances with references
Copy link
Collaborator

@srinathsetty srinathsetty left a comment

Choose a reason for hiding this comment

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

Looks great! thank you @huitseeker!

@srinathsetty srinathsetty merged commit 1e6bf94 into microsoft:main Jun 19, 2023
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