Saving and Loading taking 10+ minutes

Get general Towns support here

Re: Saving and Loading taking 10+ minutes

Postby RadioMan » Wed May 02, 2012 9:36 pm

I think it's a bit hard to give you other tips than these, java is a bit straightforward and there are not many people that complain about minutes of waiting for the game to load.
There are millions of different computerconfigurations in the world and basically your problem can be almost anything, not necessary related to this game. Again, you can check if there are some problems with your disk, see if the files are all accessible, check your antivirus (try turning off these programs while running the game, for testing purposes)
Normally I could ask to send a dxdiag output, but other than knowing what your computer configuration is exactly, this won't do much since java doesn't work with directx, knowing your computer configuration might be helpful though, maybe you have just like the other guy 16 GB of RAM or more even, I myself have 8 GB, and notice long loading times too, but just about a minute or so. Maybe this game doesn't run well in high memory configurations, or you have to force it to run in 64 bit java, if you have that installed also on your system, also look at whether you have java 6 or 7, and which one of these you run this game with, most likely the one in your path settings, not the dos path (through command prompt) but in the control panel -> system -> advanced system settings -> Advanced Tab -> Environment Variables.....
RadioMan
 
Posts: 25
Joined: Sun Apr 29, 2012 3:27 pm

Re: Saving and Loading taking 10+ minutes

Postby Tutamun » Wed May 02, 2012 9:57 pm

@supermalparit
My saved game is around 28 MB (zip File around 760 KB).
When saving you first write the whole 28 MB to a file and then zip it.
When loading you unzip the file to disk and then read the 28 MB file from disk.
Wouldn't it be faster if you write/read from a zip stream directly? Should be easy to change in theory. (Not that I have done something like this... so there may be all sorts of pitfalls...)

Are you only storing data that is in memory while the game runs or is there more data floating around somewhere else?
When I load my 28 MB saved game file the java process only takes up 613 KB. Why are saved games so insanely large? (It's normal that they take up more space... but isn't there a way to store it more efficiently?)
Also I noticed that you seem to read/write java objects to the file (using the standard serialization?). If you change a java class then the saved game will break.
Would it not be a good idea to implement a serialization that takes up less space and does not break every time a java class is modified? (I'm not thinking that we need this during Alpha or maybe even Beta... but when you release the final game you should be able to make small changes to java classes without every time breaking the saved game. If you keep the current system it will be a nightmare. I'm sure you have already planed something and just keep the current simple save/load approach during development as it does not cost you time to change the serialization each time you add or change something.)

Anyway here are my numbers: (Just one try, it could be different the next time I try.)
C:(512MB) Load: 1:10 min, Save: 0:53 min
C:(1024MB) Load: 1:07 min, Save: 0:58 min
Added option "-Duser.home=." to save in the same folder where I start Towns from. (Towns is on my second hard drive with the drive letter 'S'.)
S:(512MB) Load: 0:33 min, Save: 0:25 min
S:(1024MB) Load: 0:33 min, Save: 0:25 min

ps. I'm not saying that slow/fast hard disk drives are the only cause of slow save/load times. But many things can go wrong with hard disk drives... anti virus scanning, (write) cache vs. no (write) cache (removable drives should not use write cache), pio instead of dma access, defect sectors, connecting drive on the wrong port on the motherboard, etc.

When I copy 28 MB from one drive to the other it happens in seconds... so the difference I noticed can't be because of a slow hard disk drive. (But maybe windows caches it.)
Even using 7zip to zip/unzip the file only takes a few seconds.
I also noticed that while saving/loading both CPUs of my dual core are at 50 to 90%. (Mostly at 50% though.)
So I guess the real slow part is the standard java serialization of objects... probably in combination with a huge amount of objects. Or maybe the use of too small buffers while writing/reading the files. Or lots of garbage collections while reading/writing files. I did not check the last thing... too late, need to get to bed. :)
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Re: Saving and Loading taking 10+ minutes

Postby This is Aru » Fri May 04, 2012 4:13 pm

I didn't even think to wait long enough to see if a save would complete. I just assumed it was frozen and was killing the java process manually each time. I've just started over every time assuming that saving and loading was just broken.

Regardless, it's not just him that is having the issue. There are probably more, but who just assume that it's because it's an alpha or don't know where to say or look for anything or are just lurking in the thread.
This is Aru
 
Posts: 1
Joined: Fri May 04, 2012 4:04 pm

Previous

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests