Skip to content

Conversation

@brech1
Copy link
Collaborator

@brech1 brech1 commented May 15, 2025

Description

This PR optimizes the add_members function in src/group.rs by changing the input from Vec<Element> to &[Element], reducing memory overhead by avoiding vector cloning. Tests in src/group.rs and tests/group.rs are updated to use slice syntax.

It also fixes clippy and docs warnings.

  • What kind of change? Performance optimization (refactoring)
  • Current behavior: add_members requires an owned Vec<Element>, causing unnecessary cloning.
  • New behavior: Accepts &[Element] slice for efficient reference passing.
  • Breaking change? Yes, users must update calls to pass slices instead of vectors.

Related Issue(s)

Other information

All unit tests pass locally with updated slice syntax. No additional documentation changes needed.

Checklist

  • I have read and understand the contributor guidelines and code of conduct.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • I have run cargo fmt without getting any errors.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

@vplasencia vplasencia merged commit 0d2c7e4 into semaphore-protocol:main May 16, 2025
2 checks passed
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.

Optimize add_members in Group

2 participants