Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
515f450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how you optimize. Benchmark first, then optimize. Then you know you're increasing performance, rather than just thinking your work will increase performance without proof.
515f450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but if you want to take shots in the dark, using move instead of copy semantics is a safe bet .. just so you're SURE the moved-from instance is never again used.
515f450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's true enough, yeah.