summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-08-04 21:03:35 (GMT)
committerSkip Montanaro <skip@pobox.com>2002-08-04 21:03:35 (GMT)
commit04d80f87d7c470222eccf4e3b83ebd3e09624e7e (patch)
tree9c52d53f598ba95c97e05dbe49e9b7c8f02f7e61 /Python
parent1ee99d31d980e8a6e9c9d2379900f8bd5f98a9fe (diff)
downloadcpython-04d80f87d7c470222eccf4e3b83ebd3e09624e7e.zip
cpython-04d80f87d7c470222eccf4e3b83ebd3e09624e7e.tar.gz
cpython-04d80f87d7c470222eccf4e3b83ebd3e09624e7e.tar.bz2
small speedup for constant and name access
see sf #506436
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 50c832a..e174d09 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -494,6 +494,8 @@ eval_frame(PyFrameObject *f)
PyThreadState *tstate = PyThreadState_GET();
PyCodeObject *co;
unsigned char *first_instr;
+ PyObject *names;
+ PyObject *consts;
#ifdef LLTRACE
int lltrace;
#endif
@@ -512,8 +514,7 @@ eval_frame(PyFrameObject *f)
/* Code access macros */
-#define GETCONST(i) (GETITEM(co->co_consts, (i)))
-#define GETNAMEV(i) (GETITEM(co->co_names, (i)))
+#define GETNAMEV(i) (GETITEM(names, (i)))
#define INSTR_OFFSET() (next_instr - first_instr)
#define NEXTOP() (*next_instr++)
#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
@@ -575,6 +576,8 @@ eval_frame(PyFrameObject *f)
tstate->frame = f;
co = f->f_code;
+ names = co->co_names;
+ consts = co->co_consts;
fastlocals = f->f_localsplus;
freevars = f->f_localsplus + f->f_nlocals;
_PyCode_GETCODEPTR(co, &first_instr);
@@ -753,7 +756,7 @@ eval_frame(PyFrameObject *f)
break;
case LOAD_CONST:
- x = GETCONST(oparg);
+ x = GETITEM(consts, oparg);
Py_INCREF(x);
PUSH(x);
goto fast_next_opcode;