[Commits] [wesnoth/wesnoth] 4d0c46: Miscellaneous optimizations in display::get_terrai...

GitHub noreply at github.com
Sun Nov 26 18:07:50 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 4d0c46164e1ba3111e3d0bc03cef556c93cfa120
      https://github.com/wesnoth/wesnoth/commit/4d0c46164e1ba3111e3d0bc03cef556c93cfa120
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2017-11-26 (Sun, 26 Nov 2017)

  Changed paths:
    M changelog
    M players_changelog
    M src/display.cpp
    M src/display.hpp
    M src/sdl/surface.hpp

  Log Message:
  -----------
  Miscellaneous optimizations in display::get_terrain_images()

* The vector of surfaces is now a class member variable instead of a local
variable. This saves a memory allocation every time the function is called
- which is worth it in this case, as the function is a major performance
bottleneck.

* The surfaces are now being moved instead of copied where possible. Turns
out that freeing a SDL surface is fairly expensive in performance-critical
code.

* Pointers to ToDs are now cached, reducing the number of calls to
get_time_of_day() from 37 to 7.

In a stress-test in Aetheryn's Mod at 50 % zoom, the FPS I was getting on
my PC (Intel Core i5-4430) increased from 16 to 23.





More information about the Commits mailing list