New C2C development blog

Koshling

Vorlon
Joined
Apr 11, 2011
Messages
9,254
I need to write up changes I'm making for multi-threading, and I've been meaning to start a blog about CC work anyway for some time, so here's the teaser: http://c2cdev.blogspot.com ...
 
Next post is up (the code it refers to will e pushed to the SVN after I complete a little more testing, but hopefully this evening)
 
You'll have to merge in a few changes from me most likely but I really doubt they'd give you trouble since the scope of the changes is extremely minor.
 
:eek: I cant even believe that this:

CvPathPlotInfoStore::getPlotInfo 101,159,496 CvPathGenerator::generatePath.Success

has that many passes?:faint: And this is each turn? I didnt have any idea.

Believe it! Those are accesses to a cache of per-plot info used in path generation. Bear in mind that profile has about 65000 paths being generated on a very large map (circa 20000 tiles), and each path probably has to consider several thousand tiles, as well as different combinations of routes between them.
 
Wow... fascinating reading. I've actually managed to learn some things there rather than letting it go over my head - not all of it but some of it. Once I've digested what I did understand, I'll return to read some more. Good stuff! Thanks!
 
Seems like it spends quite some seconds in the end turn event processing in Python. Probably warrants running the Python profiler there to see what it spends all that processing on.
 
Seems like it spends quite some seconds in the end turn event processing in Python. Probably warrants running the Python profiler there to see what it spends all that processing on.

There are four turn events in Python
'BeginGameTurn' : self.onBeginGameTurn,
'EndGameTurn' : self.onEndGameTurn,
'BeginPlayerTurn' : self.onBeginPlayerTurn,
'EndPlayerTurn' : self.onEndPlayerTurn,​

Knowing when some of these are actually executed would be nice. For example I have been told that BeginPlayerTurn and EndPlayerTurn happen before control is given to the player for them to have their turn and that the second is the better one to use.
 
Seems like it spends quite some seconds in the end turn event processing in Python. Probably warrants running the Python profiler there to see what it spends all that processing on.

The vast bulk of it is REV turn end processing, so if we move REV into the DLL that should address much of it.
 
Excellent design. If I did not know already that you are a great programmer I would know it now.
 
Excellent design. If I did not know already that you are a great programmer I would know it now.

Thank you. Coming from you that mean a lot, as I have come to have a lot of respect for your skills.
 
Would it not be a better idea to allow the DLL to detect how many logical cores your machine have and set the max number of threads based on that, instead of hardcoding it as a globaldefine? I know that after 4 you start to get seriously diminishing returns, but it would make sense to test and see if we could get some measurable improvement with 6 threads on an 8 core processor.
 
Would it not be a better idea to allow the DLL to detect how many logical cores your machine have and set the max number of threads based on that, instead of hardcoding it as a globaldefine? I know that after 4 you start to get seriously diminishing returns, but it would make sense to test and see if we could get some measurable improvement with 6 threads on an 8 core processor.

Could do, but it's not a totally simple calculation as to what is optimal, because of things like turbo modes, and the difference between a virtual core (hyperthreading) vs a physical core, as well as potentially differences between an Intel (physical) core (has its own ALU) and a modern AMD one (shares ALUs between pairs of cores). However, a hardware-sensitive default (if no explicit value is given in the global define, which we would then default to 0, indicating no override) might make sense (number of virtual cores up to 3 otherwise number minus 1 would probably be a decent default, since its a pain to work out the number of physical (non hyper-threaded) cores, and you likely don't wan to absolutely 100% load the machine by default)
 
Back
Top Bottom