Add `Array.Swap()` to swap two elements in place
Open
@fxamacker is already working on this.
Since Jul 11, 2023.
enhancement
performance
- Dominant language
- Go
- Stars
- 43
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Updates https://github.com/onflow/cadence/pull/2626
Issue To Be Solved
Currently, there is no Atree function to swap two elements of an Array, so Cadence needs to do a remove and insert which can be inefficient.
Thanks @bluesign for bringing this up at https://github.com/onflow/cadence/pull/2626! 👍
Suggested Solution
Add Array.Swap() to swap two elements in place.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.