First post, by *orz*
It's me again. The guy who stopped by a year and a half with this thread:
hello AND performance
and the accompanying patches.
Anyway, I dusted off my copy the dosbox code, updated from CVS, and started coding on it a little again. First results: benchmarks again!
Instructions are categorized into types by the following four datums:
1. The first word of the disassembly (ie the characters before whitespce). Usually this is the opcode, but sometimes this is a special prefix like REPNE or somesuch. This is represnted by itself in the type string.
2. Whether or not there was a [] pair in the dissassembly string. Usually this means a memory reference. This is represented in the type string as an "M", for memory.
3. Whether or not there was a comma in the dissassembly string. Only one comma is counted, even if multiple are present.
4. Whether the comma came before or after the [] pair.
Thus, a MOV from memory to a register becomes "mov ,M", whereas a MOV from a register to memory becomes "mov M,", and a MOV from a register to a register becomes "mov ,".
Be aware that the measurement error may be fairly high. I tried a few strategies to reduce error, but all reported identical results. These numbers do not vary from run to run on the same workload. However, they vary between different workloads even when there is no obvious reason for a large discrepancy - for instance, a register to register add took an average of 266 cycles in my benchmark (compiled with MinGW) versus 121 cycles in Daggerfall. All measurements were performed on an Athlon XP 2600+ running windows 2000.
The CPU core used was a modified version of the "normal" core.
Column 1 is the percentage of time used by that instruction type, column 2 is the number of times that instruction type was executed, column 3 is the average numvers of cycles per consumed per execution of that instruction type, and column 4 is the instruction type.
From my simple benchmarks (test1 & test2 combined)
15.0324% 8.1M 576 imul ,13.0000% 15.4M 263 mov ,9.2895% 10.9M 266 add ,8.2312% 4.9M 526 mov ,M6.8621% 8.1M 263 jns6.6769% 8.1M 256 dec4.8054% 2.7M 546 movzx ,4.4453% 3.5M 396 mov M,3.4794% 2.7M 395 rol ,3.4747% 3.4M 314 cmp ,3.1752% 3.1M 320 lea ,M3.0938% 2.7M 350 jle2.9471% 2.7M 335 xor ,M2.6834% 2.7M 303 inc2.4157% 2.7M 274 and ,2.2155% 2.7M 250 xor ,1.5693% 1.0M 470 cmp M,0.9937% 710.7K 439 push0.7088% 353.0K 630 call0.6155% 693.0K 279 sar ,
From an actual run of the game "TES2: Daggerfall"
20.5124% 167.0M 196 mov ,M7.9630% 68.7M 185 mov M,6.2168% 300.1K 33082 repne6.1500% 81.9M 119 mov ,4.4693% 60.2M 118 pop4.2932% 61.1M 112 push3.9714% 52.0M 121 add ,3.4423% 2.2M 2433 repe2.7341% 23.0M 189 cmp M,2.5600% 33.9M 120 je2.2687% 26.2M 137 and ,2.0686% 24.9M 132 jmp1.9981% 18.7M 169 cmp ,M1.8657% 20.9M 141 shr ,1.7353% 21.0M 131 jne1.4961% 17.0M 140 sub ,1.4107% 16.2M 138 cmp ,1.3851% 18.0M 122 test ,1.3445% 8.6M 247 jle1.1095% 9.0M 196 call