[Commits] [wesnoth/wesnoth] 515f45: GUI2/Styled Widget: use move schematics to greatly...

GitHub noreply at github.com
Sat May 27 05:02:48 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 515f450432cda01d4c79dd1b7b546af191584450
      https://github.com/wesnoth/wesnoth/commit/515f450432cda01d4c79dd1b7b546af191584450
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-05-27 (Sat, 27 May 2017)

  Changed paths:
    M src/gui/widgets/styled_widget.cpp

  Log Message:
  -----------
  GUI2/Styled Widget: use move schematics to greatly reduce the amount of canvas copying

I added some debugging aids, and found that prior to this change, a total of *807* canvas objects
were created by the time the titlescreen was reached, and a new one almost (I think) every time a
tooltip was created.

With this change, the number of new canvas objects created as fallen to *476* by the same point
(a *331* decrease), and no new canvases are created when triggering a tooltip.

I'm not exactly sure how expensive creating a canvas is, though again, it's not a trivial object.
Avoiding hundreds of extra ones should result in some performance boost, at least.





More information about the Commits mailing list