Replies: 4 comments 2 replies
-
It seems that tracemalloc reads the
produces this output:
And this fails if It doesn't seem that this would be a language guarantee that this would happen in the right place, but it would probably be a nice thing to keep working regardless. |
Beta Was this translation helpful? Give feedback.
-
Draft PR is here: python/cpython#92105 |
Beta Was this translation helpful? Give feedback.
-
It doesn't surprise me that it isn't really any faster. That member is hardly ever read, so issuing a few extra writes (when we're already constantly writing to it) doesn't seem all that expensive to me. I also find the code that elides these writes for some opcodes quite a bit harder to reason about. Having this member set correctly is super important for correct debugging, exception handling, etc., so I would personally like to see a significant payoff before introducing that additional complexity and opportunity for error. |
Beta Was this translation helpful? Give feedback.
-
IMO, removing writes of |
Beta Was this translation helpful? Give feedback.
-
Currently,
TARGET(NOP):
expands to somthing likeIt would be nice to remove this memory write altogether on some opcodes where it's safe to do so.
To make it explicit where this is happening and where it can be avoided, can we change all of the opcodes to include this info in the instruction body? To include all of the compile-time flags, it might become something like adding these 3 lines to every opcode:
Then the
SET_FRAME_INSTR()
can probably be removed from some opcodes where it's safe: where no tracing can happen and no arbitrary python code can be invoked. Example:Before:
After:
IMO it also becomes easier to reason about the various
JUMPBY()
steps involving cache entries.Beta Was this translation helpful? Give feedback.
All reactions