The doctor is in Feb 11, 2013 @ 2:19pm
things ive done to improve performance / reduce memory usage
ok i went all out today to see if i improve performance and/or reduce memory usage. i spent hours testing and here are all the things i did and the results that i found

so that you dont have to read a wall of text each post contains a different test and the results of that test

1. plain test run
2. tweak configuratio settings
3. set cpu affinity so games does not not use core 0
4. extracted content from pak files and ran game using extracted files
5. precompiled lua source code and ran game using precompile lua bytecode
6. copied game to ssd and ran game from ssd
7. copied game to ramdisk and ran game from ramdisk
s. summary and closing thoughts
Last edited by The doctor is in; Feb 12, 2013 @ 7:35am
Showing 1-14 of 14 comments
< >
The doctor is in Feb 11, 2013 @ 3:33pm 
1. ok the first test was just to run the game along with process explorer and msi afterburner to get a base reading and record cpu, gpu, memory, disk, ect usage
Last edited by The doctor is in; Feb 11, 2013 @ 3:47pm
The doctor is in Feb 11, 2013 @ 3:33pm 
2 then i tried apply the lag tweaks found here,, and ran the game. and while i didn't notice any improvements to my framerate the game was using around 8mb more and ran perhaps a little smoother.
Last edited by The doctor is in; Feb 11, 2013 @ 4:03pm
The doctor is in Feb 11, 2013 @ 3:34pm 
3. once i had that i did the same thing with cpu affinity set to run on cores 1-5, but not 0. and i saw that it did move the main game loop from core 0 to core 1. which was great, but didnt result in any noticable increase in framerate. this is due to the fact that my computer was really not doing anything and even core 0 sits pretty dormant most of the time.
Last edited by The doctor is in; Feb 11, 2013 @ 4:00pm
The doctor is in Feb 11, 2013 @ 3:34pm 
4. then i went and using pakunpak,, utility extracted all the .pak files to a durectory called then i copyied all the files in data to overwritting any existing files. then i renamed the pak directory and finally i ran the game. i figured it takes time to load those pack files and expand the content just to get access to them and it may even take some extrea memory if they are caching them. and to my surprise the game ran great without any pack files. and i noticed that while i didn't get any framerate increase i was using about 20mb less!
Last edited by The doctor is in; Feb 12, 2013 @ 7:38am
The doctor is in Feb 11, 2013 @ 3:34pm 
5. then i went and compiled all the lua source code files that i had extracted into byte code using luac. i figured man they only have the source code so each time they want to use any lua code that they have not previsouly used they will have to bring the source code into memory, compile it and then cache the generated byte code in memory, that not only takes time, but eats up memory. once i had all the lua source code files compiled i renamed the original lua files by appending .org to their filename so they would not be used and then renamed the luac compiled files to be the same name as the original lua source code filename. finally i ran the game and again to my surprise it ran with just the bytecode lua files without any problems. and again while i only noticed a very very small framerate increase i noticed that i was using 26mb less! so having to cache pak files, source code files, byte code files was eating up around 26mb of my memory!
Last edited by The doctor is in; Feb 11, 2013 @ 4:00pm
The doctor is in Feb 11, 2013 @ 3:35pm 
6. then i went and made a copy of the current cities xl platinum with all the above changes to my ssd, renamed my current version in the steam directory and created a junction with same name as the original folder to the copy on the ssd and finally ran the game. and again it ran without any problems and while i didn't notice any increase to my framerate or any changes t how much cpu, gpu or memory i was using i noticed that it ran very smooth even when it was doing 15fps you felt you could not tell it was doing fps because it was very smooth.
Last edited by The doctor is in; Feb 11, 2013 @ 4:00pm
The doctor is in Feb 11, 2013 @ 3:59pm 
7. the i installed it on an 8gb ramdisk using the free open source ramdisk utility imdisk

i created copied the image that i created for the ssd and recreated the junction in the steam folder to refer to the ramdisk copy and ran the game and while i didn't notice any increase in my framerate and used an additional 8b it did run for the most part very smooth.
Last edited by The doctor is in; Feb 11, 2013 @ 5:07pm
The doctor is in Feb 11, 2013 @ 4:41pm 
some final thoughts

so as you can see for all my above afforts i didnt really get much of any framerate increase and only a little bit of memory. im not sure what 26mb of ram is worth. i guess a little bit more ram available for the process. on the other hand apply the lag config file tweaks resulted in about 8gb more of my memory being used without any noticeable improvements in framerate. and perhaps the game running overal smoother since i does not have to load pak files, unpack the content it wants, it just can go to the disk and get the content. also it does not have to get the lua source code and compile it, it can just use the precompiled version. all those things that it no longer has to do it take a little time the and since things are dynamically being loaded as needed it a price that you pay throught as they are being loaded until they loaded and cached.

so now the game runs great even with very low framerate so long as there are no sudden jumps in framerate or constant bouncing around of framerate from two extremes. i think that the above tests that i ran have done just about everything that i could, well other than running it out of a ramdisk and/or rewriting the lua code or replacing the game engine, to try to eliminate anything that could be slowing the game down.

so if you want a smooth fluid game run it off a ramdisk, if you dont have the extra memory and software of such a test, run if off your ssd and if you want to be extreme try all the above tweaks to get it to not have to do things like unpack pak files to get to content it needs and precompile all the lua source code so that it does not have to compile it when it needs it.

in the end while the above tests did not result in any real increase to my framerate and only a little decrease to the memory usage they did result in a very consistent framerate that felt very smooth even with very low framerate the movement around the map was very fluid.
LinkStrife Feb 11, 2013 @ 4:54pm 
You are dedicated, I'll give you that.
Sabrehawk Mar 12, 2013 @ 6:37am 
and pretty much pointless since we have no idea what system configuration you are we could make up our mind if its any worth going through all that hazzle for a more or less subjective feeling of speed improvement? All ive read about this game is that its coded badly and it will never get better cuz the peeps at Focus arent capable enough..i mean wtf releases a game heavy on cpu calculations that doesnt even properly support multi core cpus. Only numbnuts do.
Last edited by Sabrehawk; Mar 12, 2013 @ 6:39am
The doctor is in Mar 12, 2013 @ 10:55am 
my configuration is not important since i've stated that there were really no improvements to framerate, only that fact that the game ran smoother.

also i posted that test #4 saved me 26mb

so its all there in black in white. no improvement to framerate and marginal improvements to memory usage.

re: i mean wtf releases a game heavy on cpu calculations that doesnt even properly support multi core cpus. Only numbnuts do.

just about every game out there, including the latest games are coded with the game loop on a single thread. ask the people at maxim who just released simcity why they did it the way they did it. or the people at arma 3. ect.

cities xl series was originally released in 2009 and the developers probably worked on the engine for couple years to around 2007. and the engine may have evolved from their original city life engine which goes back to 2006 which would means around 2004 is when it all started.

so if you go back to those years 2007 and as early as 2004 you have to ask yourself what a typical computer would look like and what a typical game engine would look like and their you would have your answer.

look 2006/2003 which is most likely when cpu was introducted that would be in a 2007/2004 computer.

2003 - 2008 Pentium M
single core no hyperthreading!

but the same hold true to so many other game engines, including even the unreal engine and all games written using the unreal engine. even those date and even the upcoming unreal 4 engine its basically a single thread game logic loop. nothing has changed. why because game developers find it easier to write single threaded games and they primarily use interpreted scripting languages that do not support native threading, because its both easier and because it then easier to have running on a number of computers, like consoles.

these bad habbits go ack to the early gaming days, where there were not concept of multithreading or even multiple cores when cpus had only a single core and the os didn't support threading.

i honestly dont see much changing in the industry while people continue to buy the games and the companies are able to make so much money. they will all just keep tweaking their old engines and most of the tweaks are adding support for the latest eye candy that the video cards support.

also its harder to write multithreading code, costs mores and more complex. investors are not going to put up the extra money when they dont have to.

so dont focus on this game, look at the industry as a whole. and accept that for the most part they all are in the same boat.
veneur Mar 25, 2013 @ 6:40pm 
Well said. Even on console like PS3, where you have almost no main CPU power, extra CPU are almost always used to improve the graphics, plus some background stuff like decompression and network handling.. In resume, only things that are easily to multithread.

As the doctor said, the main game loop is almost single thread, simply because it is simpler this way, less likely to crash (especially that scripted gameplay is not necessarely done by programmers) and far more predictable. The complexity and issues to make it run on multithread will most likely give almost no gain unless there is very few dependencies between game elements (which usually mean an uninteresting gameplay) or will used stuff like transactional memory (like a cell automata), which more likely double the memory requirements.
noivoieidoi Apr 2, 2013 @ 7:23pm 
Great input, thanks. I really like the game, but it used to drive me crazy - sooo slow, almost stopping completely at times - I had to restart it quite often to make it work again. And I've read these posts several days ago. However, I'm lazy, I don't want to manage a ramdrive whenever I start an application that gives me headaches, so I chose to hybridize my 1TB main HDD with a cheap 32G ReadyCache SSD from Sandisk (its software takes care of everything automatically, caching the frequentely used data dynamically) And I concur, now the game runs just fine (actually all my applications run a lot better indeed, as I hoped - I wouldn't have done it for this game only).
The doctor is in Apr 2, 2013 @ 9:19pm 
great to hear

i'm thinking of doing same thing to other games

i just can only stick so much in my 128gb ssd which is really for the os

i think when i get a chance i'll buy a 256gb one for games!

u think this game is bad try battlefield 3 takes minutes upfront to the game, nothing but disk io

yeah using ramdisk tech that exist is a pain.i was thinking of doing a bunch of images, one per game, and associated batch file that when u go to play the game mount an image, sets necesary junctions, starts the game and then when u exit the game, removes the junctions and unmount the image. the problem is then u have to manage updating when u get updates and u have to keep manually updating the images
Last edited by The doctor is in; Apr 2, 2013 @ 9:23pm
Showing 1-14 of 14 comments
< >
Per page: 15 30 50
Date Posted: Feb 11, 2013 @ 2:19pm
Posts: 14