Author: Daniel Clausen
Date: 02:40:41 08/21/03
Go up one level in this thread
On August 21, 2003 at 05:16:17, Uri Blass wrote: [snip] >I payed attention to the fact that b and c can never happen if a does not >happen so I cahnge it to >if a >{ >... > if b > { >... > } > if c > { >... > } >} If b and c can only happen in case a happens, I definitely would write it like that. (as opposed to the flattened version) But not because of a potential speed gain but because it's most likely also clearer to read. (at least for me) Three if-statements in a row are independant in my understanding. If they're not, I would replace them with a switch/case, make use of 'else if' instead of normal ifs or nest them as in your example. Which one of the 3 possibilities of course depends on the concrete case. Did you measure how much speed you gained in your case? And where approx are these if-statements? (if they're not in eval, I can't image you would notice _any_ speed difference) Sargon
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.