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

feat: remove inefficient if check on match lex #777

Merged

Conversation

ChrisCho-H
Copy link
Contributor

I'm not sure whether it's intentional, but this pattern(match and then if) could make lexer little slower for OP_CSV and OP_CLTV(and Error::InvalidOpcode) as they aren't caught in match arms but if block like below(which causes additional check).

...
script::Instruction::Op(op) => {
                if op == opcodes::all::OP_CSV {
                    ret.push(Token::CheckSequenceVerify);
                } else if op == opcodes::all::OP_CLTV {
                    ret.push(Token::CheckLockTimeVerify);
                } else {
                    return Err(Error::InvalidOpcode(op))
                }
}

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK aa722c2; successfully ran local tests; nice!

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK aa722c2

@apoelstra apoelstra merged commit 76b27da into rust-bitcoin:master Nov 25, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants