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

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

Open
fxamacker opened this issue Jul 11, 2023 · 3 comments
Open

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

fxamacker opened this issue Jul 11, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@fxamacker
Copy link
Member

fxamacker commented Jul 11, 2023

Updates onflow/cadence#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 onflow/cadence#2626! 👍

Suggested Solution

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

@turbolent
Copy link
Member

@fxamacker How much work would it be to add such a function?

@fxamacker
Copy link
Member Author

@fxamacker How much work would it be to add such a function?

@turbolent About 2-3 uninterrupted person-days to add function and tests.

@fxamacker
Copy link
Member Author

@turbolent Is this feature still needed?

I can re-estimate work required because of changes in atree v0.8.0 (e.g. atree inlining & deduplication, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants