Author: Steven Edwards
Date: 10:49:21 08/28/03
Go up one level in this thread
On August 28, 2003 at 12:09:44, Russell Reagan wrote: >On August 28, 2003 at 04:08:00, Steven Edwards wrote: >Maybe that is where the difference lies. The slowdowns occured when using >non-struct variables (ex. color, square). When using struct variables, there is >no pointer overhead, becuase you would have passed a pointer anyway. For >instance, instead of the implicit this pointer when doing this: > >void Board::MovePiece (Square from, Square to); > >You would do: > >void MovePiece (Board * board, Square from, Square to); > >So you pass the pointer either way. The slowdown occurs when you use a >non-struct type. Simple and short routines are always inlined, so there's nothing that gets "passed" in those cases. >>Some compilation options can dramatically decrease run time performance. >>Support for dynamic type ID can be a killer. Dynamic binding as in Objective C >>can require a search of a hash table of method names / addresses for each call. >>Use of the run time exception processing scheme (try / catch / raise) can add a >>big penalty in some cases. >I tinkered with the compiler settings to try and get a speedup, because I >figured the pointer overhead might be avoidable. I did get the version that uses >classes to go faster, but when I recompiled the non-class version using the same >settings, it also went faster, by the same percentage. For those using gcc/g++, I should also mention the -finline-limit=n option. The default value for n of 600 is too small for even moderately aggressive inlining. I use a limit of 4096 and get much faster code.
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.