Message 78730 - Python tracker (original) (raw)
Antoine Pitrou wrote:
[...] count the number of indirect jump instructions in ceval.c:
grep -E "jmp[[:space:]]*%" ceval.s
There should be 85 to 90 of them, roughly. If there are many less, then the compiler has tried to optimize them by "sharing" them.
I get 86 with GCC 4.x and SUNCC. However, with GCC 3.4 I only get a single computed goto. Is there some hidden option to make GCC avoid sharing jumps?
Because otherwise the measurements these options are meant to do would be meaningless.
Ah, I see now. Maybe you should add a quick comment that mentions this.
I don't have a Sun machine to test, so I'll leave to someone else to check and enable if they want to.
I tested it and it worked, no test failures to report. Just change the macro test:
#ifdef GNUC &&
...
to
#ifdef (GNUC || __SUNPRO_C) &&
...
I attached some additional benchmarks on SunOS. So far, it seems the benefits of the proposed optimization are highly compiler-dependent.