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

[framework] Review basic functions for efficiency and add new natives as needed #13257

Open
wrwg opened this issue May 12, 2024 · 0 comments
Open
Labels
move-framework Issues related to the Framework modules/libraries

Comments

@wrwg
Copy link
Contributor

wrwg commented May 12, 2024

move-stdlib has some unnecessary inefficiencies in the basic libraries for vectors and strings. For instance:

public fun append<Element>(lhs: &mut vector<Element>, other: vector<Element>) {
        reverse(&mut other);
        reverse_append(lhs, other);
 }
 
 public fun reverse_append<Element>(lhs: &mut vector<Element>, other: vector<Element>) {
        let len = length(&other);
        while (len > 0) {
            push_back(lhs, pop_back(&mut other));
            len = len - 1;
        };
        destroy_empty(other);
 }

The reverse operation is unnecessary if this would be implemented on native level.

There might be other cases. Moreover, in some cases missing functions (like replace on string) need native implementations to be really efficient, and should therefore be added.

@wrwg wrwg added the move-framework Issues related to the Framework modules/libraries label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move-framework Issues related to the Framework modules/libraries
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant