Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Correction

Author: Dezhi Zhao

Date: 06:37:49 09/01/99

Go up one level in this thread


On August 31, 1999 at 14:55:54, Eugene Nalimov wrote:

>Please notice - I compared virtual method call not with the if statement, but
>with indirect function call. And once again - performance in those cases is
>comparable. And yes, you are absolutely right, for small amount of
>alternatives(less than ~5 possible cases) if's are better.
>
>Eugene
>

I think ifs are better provided alternatives are less than 3 for
P6 cpus.

call near generates 4 micro-ops
call [mem] (near) generates 7 micro-ops

too many alternatives would offset the branch prediction effect.

dzhao

>On August 31, 1999 at 13:03:43, Dan Andersson wrote:
>
>>On August 31, 1999 at 08:16:31, Dan Andersson wrote:
>>
>>>The extra  instructions could cause cashe overwrites and such, thus making it a
>>>memory bound penalty. I know that vtables are a very bad deal on x86 machines,
>>>much better to use switches and inlined functions.
>>I meant building binary desicision trees w. if statements, and inlined
>>functions. On x86 you can do aprox. four or five conditional jumps at the same
>>performance cost as one vtable lookup. If it is possible to know the
>>probabilities of method calls it is a win to make Huffman codes and construct an
>>unbalanced tree corresponding to them.
>>> C++ is only about 30% faster
>>>than natively compiled OCAML, a much better prototyping and developement
>>>language.
>>>
>>>Regards DAn



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.