Index of /misc/pentium-switch
Name Last modified Size Description
Parent Directory -
case1.S 21-Dec-1995 19:25 826
case1.c 21-Dec-1995 19:25 564
graph.ps.gz 21-Dec-1995 19:25 8.1K
switch-on-pentium 08-Dec-1995 18:26 9.4K
table.gz 21-Dec-1995 19:39 6.9K
test1 21-Dec-1995 19:25 676
The Pentium processor exhibits interesting behaviour for code that gcc
(and probably other compilers) produce for the switch statement.
switch-on-pentium contains some postings about this effect
table.gz contains some timings for various arrangements of the swicth.
a line like
11.48 00001099 0000109c
means that the code ends at 1099 (i.e., the first byte after
the code resides there, the jump table starts at 109c, and
this arrangement takes 11.48s (or an average 22.96 CPU cycles
(11.48 bus cycles) per switch).
graph.ps.gz displays the data from table graphically. The diameter of
the circles is proportional to the time taken for the
case1.c is the benchmark in C code (measuring 100,000,000 switches)
case1.S is the modified gcc assembly output (66,666,660 switches)
test1 is a script that produced table on my P133
You can find a description of a cache organization that has this
problem at http://www.amd.com/K6/k6docs/k6ds/cache.htm#332732. The
Pentium and the K6 apparently behave in the same way in this respect.
The P6 (Pentium Pro, Pentium II, Pentium III, Celeron, Xeon) and the
Athlon apparently do not have this problem (unless the data is
written). The various 486s, and the Cyrix 6x86 and 6x86MX (aka M-II)
do not have this problem because they have a unified cache.
M. Anton Ertl Some things have to be seen to be believed
email@example.com Most things have to be believed to be seen