Re:A Virtual Machine
by CodeArtisan on Saturday April 07, 2018 @06:35AM
(#16780190)
The first part of the paper compares token threading vs naive switch in cpython 3.2 which has a compile flag to disable token threading[1]. I were referring to direct threading but the difference is probably minor or irrelevant.
Nehalem shows a few outstanding speedups (in the 30 %–
40 % range), as well as Sandy Bridge to a lesser extent,
but the average speedups (geomean of individual speedups)
for Nehalem, Sandy Bridge, and Haswell are respectively
10.1 %, 4.2 %, and 2.8 % with a few outstanding values for
each microarchitecture. The benefits of threaded code decreases
with each new generation of microarchitecture.
but looking at the graphic, it seems a few benchmarks still had a +5% speed boost on Haswell.
It would also have been interesting if the paper provided the generated code by gcc for the switch statement.
If the switch statement's cases are linear (0, 1, 2, 3, ...) and if there are more than 4 cases, then gcc
token threads the code.[2]
on x64, token threading is
while direct threading is the paper saysNehalem shows a few outstanding speedups (in the 30 %– 40 % range), as well as Sandy Bridge to a lesser extent, but the average speedups (geomean of individual speedups) for Nehalem, Sandy Bridge, and Haswell are respectively 10.1 %, 4.2 %, and 2.8 % with a few outstanding values for each microarchitecture. The benefits of threaded code decreases with each new generation of microarchitecture.
but looking at the graphic, it seems a few benchmarks still had a +5% speed boost on Haswell.
It would also have been interesting if the paper provided the generated code by gcc for the switch statement. If the switch statement's cases are linear (0, 1, 2, 3, ...) and if there are more than 4 cases, then gcc token threads the code.[2]
[1] https://hg.python.org/cpython/file/v3.3.2/Python/ceval.c#l82... [2] https://godbolt.org/g/yRjFto