starknet-rs
starknet-rs copied to clipboard
Improve `FieldElement` struct construction
Description
This pull request refactors the FieldElement structure to remove the unnecessary inner field, enhancing efficiency and minimizing struct size. Additionally, it implements the std::ops::Deref and std::ops::DerefMut traits to facilitate standard struct manipulations.
Changes
- Removed the
innerfield from theFieldElementstructure. - Implemented
std::ops::Derefandstd::ops::DerefMuttraits for improved struct operations.
Impact
- Improved efficiency by eliminating redundant struct fields.
- Reduced struct size for better memory optimization.
- Simplified struct manipulation with the addition of trait implementations.
TBH I don't think the inner part makes any difference. I could be wrong but I think a single field struct should be exactly equivalent to a newtype struct in terms of performance. So changing that for better performance doesn't feel justified.
TBH I don't think the
innerpart makes any difference. I could be wrong but I think a single field struct should be exactly equivalent to a newtype struct in terms of performance. So changing that for better performance doesn't feel justified.
This one doesn't seem really relevant since we have this one in the pipeline: https://github.com/xJonathanLEI/starknet-rs/pull/562 which will delete all of this.
Yeah that's true.
starknet-ff was removed as part of #562. Closing this now as it's no longer relevant.