summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-11-20 19:25:32 (GMT)
committerGitHub <noreply@github.com>2023-11-20 19:25:32 (GMT)
commit8deb8bc2e5af0e229df87002ee8e0b0c1383f572 (patch)
tree42e2f8422a5891036ed689f35bf376b4d34eb468 /Include
parentc4c63211e83aa50927f3f1e57eacfaf4952ed228 (diff)
downloadcpython-8deb8bc2e5af0e229df87002ee8e0b0c1383f572.zip
cpython-8deb8bc2e5af0e229df87002ee8e0b0c1383f572.tar.gz
cpython-8deb8bc2e5af0e229df87002ee8e0b0c1383f572.tar.bz2
gh-112287: Speed up Tier 2 (uop) interpreter a little (#112286)
This makes the Tier 2 interpreter a little faster. I calculated by about 3%, though I hesitate to claim an exact number. This starts by doubling the trace size limit (to 512), making it more likely that loops fit in a trace. The rest of the approach is to only load `oparg` and `operand` in cases that use them. The code generator know when these are used. For `oparg`, it will conditionally emit ``` oparg = CURRENT_OPARG(); ``` at the top of the case block. (The `oparg` variable may be referenced multiple times by the instructions code block, so it must be in a variable.) For `operand`, it will use `CURRENT_OPERAND()` directly instead of referencing the `operand` variable, which no longer exists. (There is only one place where this will be used.)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_uops.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/internal/pycore_uops.h b/Include/internal/pycore_uops.h
index 8ab9aaf..e2b9489 100644
--- a/Include/internal/pycore_uops.h
+++ b/Include/internal/pycore_uops.h
@@ -10,7 +10,7 @@ extern "C" {
#include "pycore_frame.h" // _PyInterpreterFrame
-#define _Py_UOP_MAX_TRACE_LENGTH 256
+#define _Py_UOP_MAX_TRACE_LENGTH 512
typedef struct {
uint16_t opcode;