Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display: avoid unnecessarily (potentially) creating millions of temp …
…vectors I've moved the terrain hex drawing code directly into draw_visible_hexes instead of relying on get_terrain_images to return a vector of all the necessary images for each visible hex and then drawing them. Instead, we now draw each hex's images immediately without any intermediary container. With the old method, after about 10 to 15 seconds of drawing we had already allocated (and destroyed) almost 180,000 temporary vectors (a new one was created for each hex, twice per draw cycle). It's obvious how quickly that would add up over a normal play session, and though in this case the performance hit for creating each vector was probably tiny, creating them likely would have added up.
- Loading branch information
Showing
2 changed files
with
154 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters