Author: Tom Kerrigan
Date: 11:47:25 03/28/02
Go up one level in this thread
On March 28, 2002 at 09:09:37, Ratko V Tomic wrote: >The problem here is that the automatic instance creation in C++ may be >orders of magnitude more expensive than a custom code you could >tailor to the specific task. For example in generating multiple You can do this "tailoring" with C++ almost the same way you do it with C. Just have a sort of object pool, the same way you can have a thread pool. It's not like allocating a heap is free in C, either. >And then by the time you re-optimize, to remove all un-needed C++ >generalities and the implicit mechanical busy work it generates, >and take advantage of all the special circumstances, such as in >the example of board above, you end up with .C code in the .CPP >named files. Which, you then realize, you could have done to start >with and would have been done in less time for this same level of >tight optimization. Not really. By compiling with the C++ compiler, you're not losing any performance and you're gaining the ability to pick and choose between C++ features. It makes perfect sense to me to write a chess program in C, then take the engine code, put it in a class, and start multiple threads with multiple instances of the class (to make the program multithreaded). This keeps the code clean: you don't have to pass and reference "board" pointers all over, and there's hardly any performance penalty. Just because a program isn't designed to be super object-oriented from the ground up doesn't mean C++ is worthless. -Tom
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.