Performance

From what I understand it is no longer linear. The increase in early times is the base turn time plus a small amount for cities and units. Later times have that base turn time plus a larger amount for cities and units.
 
Yes, V24 is rather slow compared to anything since V19. I haven't really been on Koshling's case about it though because I know he is very busy with Viewports and AI enhancements. That said, it would be nice *hint hint* to get turns in the early to mid game to go faster.

Early turns on larger maps have increased due to the property system. Not sure it's tractable unless we lose plot sourcing of properties, or do some significant optimization work on the property solving ( I had a quick look and I didn't see any low hanging fruit really, though it's not code I am very familiar with). I would dispute later eras being any slower than before - all the most significant factors are reduced according to every measurement I have made (at given map size and civ count). The only aspect I know that has grown in processing time is city build evaluation, which is pretty much a direct function of building and unit count (which have gone up a LOT in recent versions). More can be done, but whatever we do, the more stuff we add, the slower things will get as compared to if we had not added more stuff.
 
Early turns on larger maps have increased due to the property system. Not sure it's tractable unless we lose plot sourcing of properties, or do some significant optimization work on the property solving ( I had a quick look and I didn't see any low hanging fruit really, though it's not code I am very familiar with).
There are indeed no low hanging fruit that I am aware of. Some optimizations are possible but all come with programming time investment that I am not sure is worth it.
One possibility would be short cutting some of the property manipulators so for instance diffusion is not instantiated for a plot if the property value is 0.
Which step of the property solver actually takes the most time?

I would dispute later eras being any slower than before - all the most significant factors are reduced according to every measurement I have made (at given map size and civ count). The only aspect I know that has grown in processing time is city build evaluation, which is pretty much a direct function of building and unit count (which have gone up a LOT in recent versions). More can be done, but whatever we do, the more stuff we add, the slower things will get as compared to if we had not added more stuff.
Maybe city build evaluation would be a good target for some multithreading experiments. If I get it correctly most of it consists of information gathering that is stateless and finally results in a number that could then be compared in the main thread.
 
There are indeed no low hanging fruit that I am aware of. Some optimizations are possible but all come with programming time investment that I am not sure is worth it.
One possibility would be short cutting some of the property manipulators so for instance diffusion is not instantiated for a plot if the property value is 0.
Which step of the property solver actually takes the most time?
No idea - only the outer fucntion has a profiling tag (which I added to check the overall contribution of the solver). Will need profiling adding to all the significant interior methods to determine more.
I strongly suspect short-circuiting the 0-contributors would be a big help (at least early on wheich is when it is relatively significant)


Maybe city build evaluation would be a good target for some multithreading experiments. If I get it correctly most of it consists of information gathering that is stateless and finally results in a number that could then be compared in the main thread.
Yes, that was my thought also, though I think there are other things in terms of caching that are slightly lower hanging that would be natural first.
 
I am not a C++ person, and I don't understand the code very well, but I have an idea that might help with turn times. Would it be possible to cache the build lists and AI evaluations on city construction options? Then, you would only need to recalculate the build lists and AI evaluations when a city is done with whatever it is building. It would also make it so that the build lists would only have to be remade when a new tech is discovered or a new resource is acquired. Would this be at all possible? Or am I not understanding the code at all? (this is likely):rolleyes:
 
I am not a C++ person, and I don't understand the code very well, but I have an idea that might help with turn times. Would it be possible to cache the build lists and AI evaluations on city construction options? Then, you would only need to recalculate the build lists and AI evaluations when a city is done with whatever it is building. It would also make it so that the build lists would only have to be remade when a new tech is discovered or a new resource is acquired. Would this be at all possible? Or am I not understanding the code at all? (this is likely):rolleyes:

It does a fair amount of caching of this already, but it's really not true to say it can afford to not recalculate mid-build as a blanket statement because the city's tactical situation can change significantly over the length of time some buildings take, and new techs can render previous decisions obsolete. However, it already doesn't do so if its current build is more than a certain amount progressed.

There is more to be done in this area however.
 
@AIAndy:

I was thinking about the Property System and it's effects on early-game turn time, and I had the following idea. Perhaps plot-based property values could be calculated only for tiles within x tiles of a civ's culture. Then, when a tile comes within that radius of a civilization's culture, it's value could be initialized then and there. If I understand the property system correctly, property values on a tile go to an asymtotic limit based off of the static mods and decay values. That would mean that you could initialize the values on a new tile based off of those limits, at least for Crime. I'm not too certain how the properties for Pollution or Disease work, but I think that the above statements would still be applicable. Am I all wrong on this, or is it workable and/or a good idea?
 
No idea - only the outer fucntion has a profiling tag (which I added to check the overall contribution of the solver). Will need profiling adding to all the significant interior methods to determine more.
I strongly suspect short-circuiting the 0-contributors would be a big help (at least early on wheich is when it is relatively significant)
I tried that now but it stops diffusion from 0 to negative value plots so it does not really work that simple.

@ls612: I'd rather not implement special case handling that can only be applied when the rules in the XML are in a specific way, at least not for such a limited gain.
 
I decided to do a test of performance with Talin's GEM save from the Gameplay/AI balance thread. The world in it is almost completely colonized, and it is a very mature save. For me, the results were the following.

Hardware:

-My old and crappy Core Duo @1.86 Ghz, so one core at ~1.86 Ghz for Civ.


Performance:

-An end turn, with Minimize AI turn times and Viewports, took 297 seconds for me, or almost five minutes even.

This game was at Medieval, so I'll bet that things will get worse in the Industrial and beyond, as there will be far more build options. It'll be interesting to see what others will have for performance.

@AIAndy: OK, that makes sense, it won't be that much of a gain anyways.
 
I decided to do a test of performance with Talin's GEM save from the Gameplay/AI balance thread. The world in it is almost completely colonized, and it is a very mature save. For me, the results were the following.

Hardware:

-My old and crappy Core Duo @1.86 Ghz, so one core at ~1.86 Ghz for Civ.


Performance:

-An end turn, with Minimize AI turn times and Viewports, took 297 seconds for me, or almost five minutes even.

This game was at Medieval, so I'll bet that things will get worse in the Industrial and beyond, as there will be far more build options. It'll be interesting to see what others will have for performance.

@AIAndy: OK, that makes sense, it won't be that much of a gain anyways.

I thought that I would do another test using the same save on my new rig, to see what the difference was and how much could be expected from a modern computer running C2C. Here are the results;

Hardware:

-A brand spanking-new Toshiba with an Intel i7 3610 (Ivy Bridge) @2.3 Ghz, but it goes to 3.1 Ghz for single-threaded apps, so that is probably what I was getting.

Performance:

-An end turn, with Minimize AI turn times and Viewports, took 150 seconds for me, or almost two and a half minutes even.

So, I essentially doubled my performance, which is very nice, though as Koshling has said there is much more room for improvement.

Also, there is an issue with the modifier recalc, which I will get into in another thread. For kicks, with a 75 by 50 viewport with High settings across the board, and High-Resolution Terrain, C2C was only using 2 GB of RAM, which I though was very good.
 
For the multiplayer tests I had to use the "multiple" command line option to be able to start more than one instance of Civ4 at the same time. The weird thing I noticed was that they seem to use up LESS memory than starting it the normal way (each of the small map first turn instances of Civ4 only used 611MB). I have no idea what the engine does different but it was a considerable difference.
In a test game I loaded now which is still quite early on a normal map the task manager reported 1150MB used on a normal load and only 900MB when I started Civ4 with the "multiple" option.

So I'd ask you to run some tests yourself on your games. Start Civ4 in the normal way, load your game and then check the memory usage.
Afterwards change your shortcut to contain multiple. For instance like this:
"C:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Civ4BeyondSword.exe" multiple mod=\Caveman2Cosmos
Then compare your memory usage and report to this thread. Maybe also play some turns to see if it feels any different (not game mechanic wise but in graphics behavior or performance).
 
@AIAndy:

Hmm, You're right. I tested an early save with one, two, and three concurrent BtS Processes, and it did not scale linearily. With a 75 by 50 Viewport and all graphical settings on high, running one instance took 990 MB of RAM, two instances took 1443 MB of RAM, and 3 instances took 1801 BM of RAM. I stopped there becuase my processor was having trouble with that many C2C instances plus a program installing in the background. I have no idea why this is or how it could be important, but there you are.
 
@AIAndy:

Hmm, You're right. I tested an early save with one, two, and three concurrent BtS Processes, and it did not scale linearily. With a 75 by 50 Viewport and all graphical settings on high, running one instance took 990 MB of RAM, two instances took 1443 MB of RAM, and 3 instances took 1801 BM of RAM. I stopped there becuase my processor was having trouble with that many C2C instances plus a program installing in the background. I have no idea why this is or how it could be important, but there you are.

That's not what AIAndy meant. He meant that a SINGLE instance with 'multiple' on took less than the same single instance without. What you are seeing is just single-imaging of the code, which is entirely expected.
 
That's not what AIAndy meant. He meant that a SINGLE instance with 'multiple' on took less than the same single instance without. What you are seeing is just single-imaging of the code, which is entirely expected.

Oh, I am misunderstanding things here. I will try again, with 'multiple' in the shortcut and without, and post the results.
 
That's not what AIAndy meant. He meant that a SINGLE instance with 'multiple' on took less than the same single instance without. What you are seeing is just single-imaging of the code, which is entirely expected.

:hmm:This is odd. Running the game with AIAndy's shortcut code, Talin's old and very advanced save, and a 75 by 50 viewport, the game used 1,670,912 KB of memory. Running it without the multiple in the shortcut increased it only to 1,674,332 KB of memory usage, according to the Task Manager.
 
:hmm:This is odd. Running the game with AIAndy's shortcut code, Talin's old and very advanced save, and a 75 by 50 viewport, the game used 1,670,912 KB of memory. Running it without the multiple in the shortcut increased it only to 1,674,332 KB of memory usage, according to the Task Manager.
In that case the difference I saw was probably just a fluke or due to it messing around with my settings as it unfortunately sometimes does (deleting my old ones ...).

EDIT: Looks like the difference in memory usage was between cached load and non cached load. That means though something about my check if an uncached load is needed considers it necessary to do one when you switch between cached and uncached load which is quite weird.
 
i watched a youtube video about modding fallout 3. They said that fallout 3 can just use 2 gigabyte ram. if i am not wrong its the same case with civ 4. the video present a programm that can increase the memory a program use (not just follout 3) from 2 to 4 gygabite ram. i think its name is CFF Explorer. is it possible to use this for civ 4 .i am just a noob but maybe it will help. here is the link to the youtube video with the tutorial the program is present at 05:05 minutes. and they explain how to use it
http://www.youtube.com/watch?v=tONiXNbwSt0&feature=player_embedded#!
sorry for my bad englisch i just want to help
 
Not sure if this helps but as an FYI:

I'm running C2C on WinXP, Pentium IV (i.e. single core) 2.8Ghz, 3GB RAM (with 3GB boot switch option), 256MB NVidia 7600GT, with viewports (standard unmodified size) and Video Options set to High.

On average from a direct fresh warm boot up, my machine takes 9 minutes to get to the C2C Option/selection screen. It's a little bit disconcerting because for the first half of that time you can't tell the PC is doing anything unless you look at the hard drive light.

Once there it takes another 3 minutes to load a relatively small save (circa 19660 BC, 'Large' map and I believe my CIV is the only one with more than 1 city... though I've only met 3 AI CIVs).

End of Turn waits are still pretty fast (10 seconds or so, haven't timed that yet).

Starting a new game (only done once so far with a 'Large' map and without viewports at the time) also seemed to take a long time. I wish I timed it, but I'm sure it was multiple minutes (certainly discourages using the regenerate map option).

Oh, and I get CTDs if I try to play a loaded save without Viewports. My initial start was without viewports and I went 4+ hours without a CTD.
 
So...
Does it mean that the end-turn SLEEPING time will never be removed, unless I buy a 6GHz PC???
I'm so dejected...
Anyways, is this due to the MOD's programming specifics, or it was so also in vanilla - just it had 100 times less FEATURES, so it wasn't felt???
In the second case - it's hopeless.
In the first - I'm sure if someone with good programming skills took a look at the problem SERIOUSLY...
 
Back
Top Bottom