Author: Hristo
Date: 19:02:43 08/02/04
Go up one level in this thread
On August 02, 2004 at 14:47:03, Bo Persson wrote: >On August 02, 2004 at 04:39:31, Uri Blass wrote: > > >> >>I do not understand much about speed optimizations. >> >>I do not care about doing the program as fast as possible and I only care not to >>do it slower because of classes. > >Why do you think it would be slower? > >> >>This is the reason that I prefer varaibles that are not used often in classes. > >Variables that are not used often doesn't matter at all. > > >>varaibles that are used often also may mean more changes to the code in order >>not to have them as global varaibles in case that they are used in many places >>of the code. >> >>I use hply not only in makemove but also in the code that check repetition and >>sometimes in the search code when I want to look at the history to decide about >>extensions so replacing this global varaible by something else does not seems to >>me very simple. >> >>You are probably right that putting hply in another class is only a negligible >>overhead but the problem is not only speed > >Gerd's point was actually that you can *gain* speed by using classes! :-) > >Code that accesses global variables will have to carry the address of the >variable in the instructions. That makes the code larger, and potentially >slower. > >Code that accesses several members of a class, will probably load the 'this' >pointer in a register once, and then reuse that address in several instructions. >This often makes the resulting code smaller, and faster. > >I have seen this happen several times. > > >>hply is only one global varaible and I have a lot of other global varaibles and >>arrays. > >What if *that* is the problem and not the cure? There is that problem with optimizations, people are often concerned about the wrong thing. I'm not sure how Uri or anyone else, for that matter, can easily and reliably determine where the execution bottlenecks are, without using a profiler. To answer your question, one has to use a profiler or some equivalent tool. Without the the correct tool the answer to your question is pretty much a crap-shoot. ;-) Regards, Hristo > > > >Bo Persson
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.