widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11425
Re: [Merge] lp:~widelands-dev/widelands/ai_variables_rework into lp:widelands
I am going to use [] in my next branch I have in my head. And also current iterators can be reworked to [] if I was in a mood :)
I looked at the deque issue. First, all those deques are "iterated" - a member is moved from one side to another, but yes, on some of them also "remove in the middle" is done. When I look at biggest ones, it looks like:
std::deque<Widelands::BuildableField*> buildable_fields: rotating
std::deque<Widelands::MineableField*> mineable_fields: rotating
std::deque<Widelands::FCoords> unusable_fields: rotating
So these are only front/back manipulated
std::deque<Widelands::Flag const*> flags: rotating, remove in the middle
std::deque<Widelands::Road const*> roads: rotating, remove in the middle
std::deque<Widelands::Flag const*> new_flags: rotating, remove in the middle
Yes, here some removing in the middle is done. But rotating is regular (every X seconds Y members are rotated). Removing from the middle is as needed (e.g. teritory dissapears so roads and flags are gone)
So this is not such conclusive as you think...
I saw some benchmarks comparing various operations on vector, list and deque and deque was not that bad at all and usually significantly faster than list
--
https://code.launchpad.net/~widelands-dev/widelands/ai_variables_rework/+merge/333041
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai_variables_rework into lp:widelands.
References