Author: Robert Hyatt
Date: 20:02:55 04/09/03
Go up one level in this thread
On April 09, 2003 at 18:21:27, Daniel Clausen wrote: >On April 09, 2003 at 17:59:18, Robert Hyatt wrote: > >>On April 09, 2003 at 12:29:20, Daniel Clausen wrote: >> >>>On April 09, 2003 at 12:12:22, Robert Hyatt wrote: >>> >>>>if (wtm == 1) >>>> score+=bonus1 >>>>else >>>> score+=bonus2; >>>> >>>>You could turn that into: >>>> >>>>score+=wtm*bonus1 + (wtm^1)*bonus2; >>>> >>>>the new code does more work, but has no branch to mispredict. >>> >>>And it's soo incredibly readable. :p I know this is not the discussion here, but >>>I wanted to point the out nevertheless. :) >>> >>>Sargon >> >> >>In that case, yes. But in other cases, it is much harder to read because both >>sides of the "branch" are encoded into a single instruction and it is not clear >>what is going on.... > >Um.. I'm not sure I understand you now.. are you saying that you find the >version "score+=wtm*bonus1 + (wtm^1)*bonus2" more readable? > >In this case I'm a tad surprised. > >Sargon Possibly. For very simple constructs like the above. But for more complex examples, no way I'd think it is more readable. A beginner might not think so, any more than he would think bitmaps are readable. But once you get used to the "look", it is very easy.
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.