[Python-Dev] Why is Bytecode the way it is? (original) (raw)
Skip Montanaro skip at pobox.com
Thu Jul 15 01:31:38 CEST 2004
- Previous message: [Python-Dev] Why is Bytecode the way it is?
- Next message: [Python-Dev] Why is Bytecode the way it is?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Chris> While recently goofing around with the bytecode, I thought of
Chris> doing something like this:
Chris> case LOAD_CONST:
Chris> x = GETITEM(consts, oparg);
Chris> Py_INCREF(x);
Chris> + if (*next_instr == RETURN_VAL) {
Chris> + retval = x;
Chris> + why = WHY_RETURN;
Chris> + goto fast_block_end;
Chris> + }
Chris> PUSH(x);
Chris> goto fast_next_opcode;
Chris> This would skip the stack and a trip through the loop without
Chris> changing the parser or the bytecode, and with a minimal amount of
Chris> added code or overhead.
You'd have to test it. You'd speed up getting to the return point at the expense of slowing down every other LOAD_CONST instruction.
Skip
- Previous message: [Python-Dev] Why is Bytecode the way it is?
- Next message: [Python-Dev] Why is Bytecode the way it is?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]