onflow / onflow/atree

Add `Array.Swap()` to swap two elements in place

Open
#326 4 comments 2 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.