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
1=== modified file 'unity-shared/GraphicsUtils.cpp'
2--- unity-shared/GraphicsUtils.cpp 2012-10-31 16:33:00 +0000
3+++ unity-shared/GraphicsUtils.cpp 2012-11-08 10:24:18 +0000
4@@ -53,10 +53,10 @@
5
6 void PopOffscreenRenderTarget()
7 {
8- g_assert(rendering_stack.size() > 0);
9+ g_assert(!rendering_stack.empty());
10
11 rendering_stack.pop();
12- if (rendering_stack.size() > 0)
13+ if (!rendering_stack.empty())
14 {
15 nux::ObjectPtr<nux::IOpenGLBaseTexture>& texture = rendering_stack.top();
16 PushOffscreenRenderTarget_(texture);
17@@ -68,4 +68,4 @@
18 }
19
20 }
21-}
22\ No newline at end of file
23+}