Just fyi - test of modified python core.
- c o v e n t r y -
coventry at removethisandallhyphens-o-n-e.net
Mon Jul 1 12:29:36 EDT 2002
This is just an FYI regarding my latest experiment to speed up python.
After doing some research and finding that gcc is capable of having
pointers to labels in C/C++ code, I decided to try something: I modified
the python interpreter's main loop to utilize an array of label pointers
whose indices were equal to the bytecode they were for. Thus, in
pseudo code, I change this:
switch (bytecode)
case BYTECODE1:
do something;
break;
-----------------------------
into:
[label array for bytecodes]
goto labelarray[bytecode];
BYTECODE1:
do something;
goto end_loop;
-----------------------------
The results of this change were not as expected... as you can see from
the pystone results below.
avg results
python2.2: 7142.
python2.2-experimental: 7142.
------------------------------------------
Conclusion: this gcc compiler trick is useless in the main loop, since
gcc is apparently either A) generating code equivilent to a
label-array-goto for the main switch or B) producing code that runs at
equivilent speed. I'm leaning towards A.
Ah well, at least it only took a few hours to find out ;)
-c
More information about the Python-list
mailing list