mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
GH-93516: Speedup line number checks when tracing. (GH-93763)
* Use a lookup table to reduce overhead of getting line numbers during tracing.
This commit is contained in:
parent
45e62a2bc1
commit
ab0e601016
6 changed files with 101 additions and 8 deletions
|
|
@ -254,6 +254,7 @@ def generate_code(self, name: str, code: types.CodeType) -> str:
|
|||
self.write(f".co_exceptiontable = {co_exceptiontable},")
|
||||
self.field(code, "co_flags")
|
||||
self.write(".co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,")
|
||||
self.write("._co_linearray_entry_size = 0,")
|
||||
self.field(code, "co_argcount")
|
||||
self.field(code, "co_posonlyargcount")
|
||||
self.field(code, "co_kwonlyargcount")
|
||||
|
|
@ -271,6 +272,7 @@ def generate_code(self, name: str, code: types.CodeType) -> str:
|
|||
self.write(f".co_name = {co_name},")
|
||||
self.write(f".co_qualname = {co_qualname},")
|
||||
self.write(f".co_linetable = {co_linetable},")
|
||||
self.write("._co_linearray = NULL,")
|
||||
self.write(f".co_code_adaptive = {co_code_adaptive},")
|
||||
for i, op in enumerate(code.co_code[::2]):
|
||||
if op == RESUME:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue