-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
txscript: Improve conditional stack.
This commit improves the way the conditional execution stack is handled in a few ways. First, the current execution state is now pushed onto the end of the slice rather than the front of it. This has been done because it results in fewer allocations and is therefore more efficient. Second, the need for allocating and setting an initial true in the conditional stack has been eliminated. The vast majority of scripts don't contain any conditionals, so there is no reason to allocate a slice when it isn't needed. Third, a new function has been added to the engine to determine if the current conditional branch is executing named isBranchExecuting which handles the fact the conditional execution stack can now be empty and improves the readability of the code. Finally, it removes a couple of TODOs which I have verified do not apply.
- Loading branch information
Showing
2 changed files
with
31 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters