URL:
  <http://gna.org/patch/?2819>

                 Summary: Change unit_map to a faster implementation
                 Project: Battle for Wesnoth
            Submitted by: thonsew
            Submitted on: Thu 21 Jul 2011 04:52:11 PM GMT
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

This patch changed unit_map from an implementation using 2  std::maps to one
using 2 boost::unordered_maps.  std::map has O(log n) lookup time , while
boost::unordered_map has O(1) lookup.  This speeds up unit_map::find(loc/uid)
operations, which are used often.

boost::unordered_map can be replaced with std::unordered_map if wesnoth
adopts c++0x.

I profiled 1 turn of NR Showdown to verify the improvement.

thonsew





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 21 Jul 2011 04:52:11 PM GMT  Name: unit_map_hash.patch  Size: 6kB  
By: thonsew

<http://gna.org/patch/download.php?file_id=13618>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?2819>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to