Search found 1062 matches
- Tue Oct 04, 2011 3:07 pm
- Forum: Programming
- Topic: [RESOLVED] Condition::Contains implementation
- Replies: 115
- Views: 13079
Re: Condition::Contains implementation
Regardless of whether Eval is destructive or preserving of the input candidates set, perhaps using std::list instead of a std::set or std::vector would work for ObjectSet / TargetSet? We presently don't need to locate a particular UniverseObject in the ObjectSet, so using a vector or map indexed by...
- Tue Oct 04, 2011 2:56 pm
- Forum: Programming
- Topic: [RESOLVED] Condition::Contains implementation
- Replies: 115
- Views: 13079
Re: Condition::Contains implementation
I'll try to be more detailed. The major problem actually isn't slow containers, but the tremendous amount of container operations - although I admit, that copying a std::vector should be substantially faster than copying an equally-dimensioned std::set. Many, if not most (by number of calls) of tho...
- Mon Oct 03, 2011 7:31 pm
- Forum: Programming
- Topic: [RESOLVED] Condition::Contains implementation
- Replies: 115
- Views: 13079
Re: Condition::Contains implementation
What do you think about non-destructive Eval() signatures? Many insertions are simply copies of an existing container, just for later moving obects from the copy to a new container. I think it might be very helpful to provide a variant of Eval() that populates a container (two containers?) but leav...
- Mon Oct 03, 2011 7:30 pm
- Forum: Programming
- Topic: [RESOLVED] Condition::Contains implementation
- Replies: 115
- Views: 13079
Re: Condition::Contains implementation
std::vector is probably a sensible choice - however, it requires a careful evaluation of existing code, due to the iterator invalidation problem. There should be no invalidation problem if there are no insertions or deletions (and there shouldn't be!). I mean something like this: // at most one of ...
- Mon Oct 03, 2011 1:19 pm
- Forum: Programming
- Topic: [RESOLVED] Condition::Contains implementation
- Replies: 115
- Views: 13079
Re: Condition::Contains implementation
I hope we can do even better than hashing by just using a std::vector<> to represent the UniverseObject sets (this assumes that the index into the vector is the object ID, and that the highest object ID never gets too high for use to use this trick). We should definitely try hashing first though.
- Mon Oct 03, 2011 1:16 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
Nice. A 3-orders-of-magnitude slowdown! Let's hope we can do better somehow.
Carsten, if you have time, can you do a callgrind run with Geoff's patch?
Carsten, if you have time, can you do a callgrind run with Geoff's patch?
- Sat Oct 01, 2011 2:26 am
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
Cool. I'll use the 1.47 Spirit feature I need then.
- Fri Sep 30, 2011 7:15 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
I'd like to use 1.47... I doubt it will sway you, but I'm reluctant to require the latest release of Boost, as there are often posters trying to compile on Linux who can't seem to get the latest version of Boost easily on their systems. Then again, not that many people seem to be compiling on Linux...
- Fri Sep 30, 2011 12:57 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
Can you upgrade to Boost 1.47 and see if that has any effect? I switched to Boost 1.47, and it definitely had an effect, but I don't think it was an upgrade... Do we know if it at least steps around our Boost.Graph compiler bug? Some of that is a known problem: https://svn.boost.org/trac/boost/tick...
- Fri Sep 30, 2011 4:01 am
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
While I'm waiting on that, I thought I'd try replacing the storage of ObjectMap (std::map<int, UniverseObject*>) with boost::unordered_map<int, UniverseObject*>. It doesn't break the binary file format, and it shaves off another 0.2 seconds. Patch attached. From here out, I'm going to let Carsten le...
- Fri Sep 30, 2011 3:16 am
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
boost::johnson_all_pairs_shortest_paths() -> boost::floyd_warshall_all_pairs_shortest_paths() (and the associated #include) Using floyd gives me more errors of this sort: boost_1_46_1\boost/graph/floyd_warshall_shortest.hpp(127): error C2664: 'boost::multi_index::get' : cannot convert parameter 2 f...
- Fri Sep 30, 2011 3:14 am
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
Ugh. I'll have to tackle this tomorrow. Sorry for the breakage. Commenting out the include line, and the line where the johnson stuff is used seems to get it to build. (I didn't try just one or the other). Edit: Although FreeOrion is crashing for me at startup after doing that... although that may ...
- Thu Sep 29, 2011 6:32 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
About 4 times faster for very large galaxies. Not sure if the speedup will be the same for smaller galaxies.eleazar wrote:So for the less technical of us-- generally what kind of speedup for the time between turns are we looking at here?
- Thu Sep 29, 2011 5:39 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
It may look dangerous, but it's precisely the same. -both oldfile and newfile begin by saving begin and end of from_set -although newfile does not save "it", neither "it" nor from_set is modified until "it" is dereferenced -neither distances, nor subcondition matches c...
- Thu Sep 29, 2011 12:32 pm
- Forum: Programming
- Topic: [PATCH] WithinStarlaneJumps implementation
- Replies: 78
- Views: 8334
Re: [PATCH] WithinStarlaneJumps implementation
Ugh. I'll have to tackle this tomorrow. Sorry for the breakage. Commenting out the include line, and the line where the johnson stuff is used seems to get it to build. (I didn't try just one or the other). Edit: Although FreeOrion is crashing for me at startup after doing that... although that may ...