Merge lp:~mc-return/unity/unity.merge-minor-possible-speed-improvement into lp:unity

Proposed by MC Return
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 2903
Proposed branch: lp:~mc-return/unity/unity.merge-minor-possible-speed-improvement
Merge into: lp:unity
Diff against target: 23 lines (+3/-3)
1 file modified
unity-shared/GraphicsUtils.cpp (+3/-3)
To merge this branch: bzr merge lp:~mc-return/unity/unity.merge-minor-possible-speed-improvement
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Thomi Richards (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+133435@code.launchpad.net

Commit message

Minor possible performance improvement by replacement of 'rendering_stack.size() > 0' with '!rendering_stack.empty()' in unity-shared/GraphicsUtils.cpp.
xxxx.size() can take linear time while xxxx.empty() is guaranteed to take constant time.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Looks good to me. I'm happy to merge this without tests.

review: Approve
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'unity-shared/GraphicsUtils.cpp'
--- unity-shared/GraphicsUtils.cpp 2012-10-31 16:33:00 +0000
+++ unity-shared/GraphicsUtils.cpp 2012-11-08 10:24:18 +0000
@@ -53,10 +53,10 @@
5353
54void PopOffscreenRenderTarget()54void PopOffscreenRenderTarget()
55{55{
56 g_assert(rendering_stack.size() > 0);56 g_assert(!rendering_stack.empty());
5757
58 rendering_stack.pop();58 rendering_stack.pop();
59 if (rendering_stack.size() > 0)59 if (!rendering_stack.empty())
60 {60 {
61 nux::ObjectPtr<nux::IOpenGLBaseTexture>& texture = rendering_stack.top();61 nux::ObjectPtr<nux::IOpenGLBaseTexture>& texture = rendering_stack.top();
62 PushOffscreenRenderTarget_(texture);62 PushOffscreenRenderTarget_(texture);
@@ -68,4 +68,4 @@
68}68}
6969
70}70}
71}
72\ No newline at end of file71\ No newline at end of file
72}