Author: Gerd Isenberg
Date: 14:02:09 07/09/03
Go up one level in this thread
Hi Jeremiah, Yes, also on Athlon xp2.8+ with MSVC 6 - little surprise due to the call overhead. But "switch" is a bit size optimized, some jumps to common case code. I used __assume(0) in switch default cases (Reinhard, Tim and switch256, Heiner requires explicit case -1: donothing) to avoid one additional conditional jump before the indirect switch jump. Anyway funcp is fastest most often - all these tiny, very cache friendly functions are 16 Byte aligned (with a lot of nops inbetween). But there is of course some "noise" in this dumb loop test, based on the order of funcp-functions and "bad" random numbers. Of course no serious test - just an instructional fun contest. The "surprise" for me is that the simple approach seem to outperform Andrew's approach, may be due to the higher bits have no higher probability with the low density numbers. Even if it's a kind of "perverse", i like Heiner's approach very much, with the "cases" in deeper and deeper nested if-blocks. Regards, Gerd lonesome one bit: Simple 0x20e17a76, time = 1.762 Andrew 0x20e17a76, time = 1.783 Tim 0x20e17a76, time = 1.412 Heiner 0x20e17a76, time = 1.352 Reinhard 0x20e17a76, time = 1.502 switch 0x20e17a76, time = 1.302 funcp 0x20e17a76, time = 1.221 up to two one bits: Simple 0x226c8b78, time = 1.903 Andrew 0x226c8b78, time = 1.983 Tim 0x226c8b78, time = 1.632 Heiner 0x226c8b78, time = 1.623 Reinhard 0x226c8b78, time = 1.802 switch 0x226c8b78, time = 1.713 funcp 0x226c8b78, time = 1.332 up to three one bits: Simple 0x23f27d79, time = 2.083 Andrew 0x23f27d79, time = 2.163 Tim 0x23f27d79, time = 2.043 Heiner 0x23f27d79, time = 1.902 Reinhard 0x23f27d79, time = 2.113 switch 0x23f27d79, time = 1.863 funcp 0x23f27d79, time = 1.492 eight random bits: Simple 0x83001752, time = 3.175 Andrew 0x83001752, time = 3.134 Tim 0x83001752, time = 5.188 Heiner 0x83001752, time = 3.375 Reinhard 0x83001752, time = 4.656 switch 0x83001752, time = 1.442 funcp 0x83001752, time = 1.493 eight random bits high one probability: Simple 0xb78285c8, time = 2.663 Andrew 0xb78285c8, time = 2.885 Tim 0xb78285c8, time = 7.240 Heiner 0xb78285c8, time = 3.305 Reinhard 0xb78285c8, time = 6.499 switch 0xb78285c8, time = 1.763 funcp 0xb78285c8, time = 1.822 eight one bits 0xff: Simple 0x0642ac00, time = 0.811 Andrew 0x0642ac00, time = 1.062 Tim 0x0642ac00, time = 8.853 Heiner 0x0642ac00, time = 1.542 Reinhard 0x0642ac00, time = 7.511 switch 0x0642ac00, time = 0.721 funcp 0x0642ac00, time = 1.011
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.