CleverRaven/Cataclysm-DDA — pull request #2229 by atomicdryad (2013-07-28 10:34:09+00:00)
Title: Refactor the field system due to the incredible amounts of overhead and slowdown the previous refactor introduced in large fires.

+ process_fields_in_submap: Eliminate hundreds of thousands of field iterations via pointer variables
in process_fields_in_submap (instead of if(ptr->findField(..) && ptr->findField(..)->something() ) {
ptr->findField(same_freaking_field)->stuff.

+ field::* Completely eliminate the need for iteration by changing field storage from std::vector to
std::map.

In a burning hospital test case, this reduced the runtime of process_fields_in_submap from ~1000 ms to
~300 ms; switching to variables instead of performing repeated lookups for the same thing took it to
~650ms, switching to std::map accounts for the rest.

Further optimization is possible; caching fire and smoke in a struct array made the
same scenario process in 110ms. Lightmap is also incredibly wasteful as light sources cast rays into
light sources in the next tile.