-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Open
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Description
DELETE_FAST has two uses:
delete varwherevaris a local variable- Cleaning up at the end of a named exception block.
A local variable can be deleted with the sequence PUSH_NULL; STORE_FAST var.
Deleting a local variable
Instead of DELETE_FAST n we can emit LOAD_FAST n; POP_TOP n; PUSH_NULL; STORE_FAST n which the bytecode optimizer will reduce to PUSH_NULL; STORE_FAST n in most cases.
Cleaning up at the end of a named exception block.
We currently emit the sequence: LOAD_CONST None; STORE_FAST n; DELETE_FAST n
which can be replaced with PUSH_NULL; STORE_FAST n
This case is far more common than explicitly deleting a local variable, so we can reduce code size as well as freeing up an opcode.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage