Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
481 stars 77 forks source link

Very long saving times #285

Closed ghost closed 9 years ago

ghost commented 9 years ago

over 30 seconds for some games/maps, half the time for loading. Seen on 2 different Debian 64 machines.

Flamefire commented 9 years ago

Which maps (size?) and do you have a savegame of such a case so we can reproduce this?

ghost commented 9 years ago

Size 256x256, 7 players, game 'Ohne Namen' from author 'Niemand'. But I assume on my other pc it was another game/map. Where to put the savegame?

Flamefire commented 9 years ago

Just any filehoster dropbox etc. Examples: http://zippyshare.com http://sendspace.com

ghost commented 9 years ago

http://www24.zippyshare.com/v/7rxR5OFi/file.html

bluss commented 9 years ago

I suggest replacing the std::set and std::maps used in serialization with hashmap based datastructures. Looks like a first simple algorithmic win (O(n) instead of O(n log n)).

Edit: Since the containment check is linear, current code is actually quadratic / O(n²) -- see #297

bluss commented 9 years ago

I think this is fixed by #297 actually. It's so fast now I can't believe it (tested on big maps, comparing to old version).

Flamefire commented 9 years ago

Have you tested this with the provided savegame? He said something about 30s saving/15s loading... Also make sure you are not only using big maps to test but also big maps with many objects. (You e.g. start a game with many AIs and jump 100k GFs forward or so) Just want to make sure, this is actually done before we close it.

bluss commented 9 years ago

I haven't looked at the provided save game. I tried one of my own that saves in upwards 30 seconds (and I've played larger games where it's even slower), and it's much much faster now. Feel free to wait until it's further confirmed.

Flamefire commented 9 years ago

@fguzm Can you check, if this is also solved for your game now? Then this can be closed

ghost commented 9 years ago

@Flamefire the latest file is from yesterday, so I cannot test

Flamefire commented 9 years ago

@fguzm Yes the build server did not build... Now it is available.

ghost commented 9 years ago

I think this is called light-speed