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

xcvm: simplify instructions handling in interpreter contract #3668

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Commits on Jun 8, 2023

  1. xcvm: simplify instructions handling in interpreter contract

    XCVMProgram::instructions is a VecDeque.  The simplest way to split it
    into first element and tail containing the rest of the instruction is
    to use pop_front method.  In fact, this is a constant-time operation.
    
    However, handle_execute_step does a strange dance where it converts
    the instructions into an iterator and then collects the iterator into
    a new VecDeque.  That’s an O(n) operation with an additional
    allocation.
    
    Simplify the code to use the pop_front instead.
    mina86 committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    7b14af6 View commit details
    Browse the repository at this point in the history