Merge lp://staging/~josharenson/unity-scopes-shell/fix-overview-results-sorting into lp://staging/unity-scopes-shell

Proposed by Josh Arenson
Status: Approved
Approved by: Paweł Stołowski
Approved revision: 355
Proposed branch: lp://staging/~josharenson/unity-scopes-shell/fix-overview-results-sorting
Merge into: lp://staging/unity-scopes-shell
Diff against target: 44 lines (+19/-14)
1 file modified
src/Unity/overviewresults.cpp (+19/-14)
To merge this branch: bzr merge lp://staging/~josharenson/unity-scopes-shell/fix-overview-results-sorting
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Paweł Stołowski (community) Approve
Review via email: mp+313075@code.staging.launchpad.net

Commit message

Fix the list sorting of overviewresults

When the results for the model were set, the loop responsible for sorting them
was being executed hundreds of thousands of times. It has been replaced with a
simple insertion sort.

Description of the change

Fix the list sorting of overviewresults

When the results for the model were set, the loop responsible for sorting them
was being executed hundreds of thousands of times. It has been replaced with a
simple insertion sort.

To post a comment you must log in.
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Looks good to me, thanks!

As discussed on IRC, it's not clear what made the previous implementation so slow (although the fact the 'i' wasn't incremented on every iteration could be part of the problem), but what you propose make sense and is an improvement, the tests are passing and I haven't found any regression with this change, so +1.

One remark only, could you please remove the extra line before we land this:
32 + for (int i = 1; i < m_results.size(); i++) {
33 +

review: Approve
356. By Josh Arenson

Clean syntax

Revision history for this message
Josh Arenson (josharenson) wrote :

> Looks good to me, thanks!
>
> As discussed on IRC, it's not clear what made the previous implementation so
> slow (although the fact the 'i' wasn't incremented on every iteration could be
> part of the problem), but what you propose make sense and is an improvement,
> the tests are passing and I haven't found any regression with this change, so
> +1.
>
> One remark only, could you please remove the extra line before we land this:
> 32 + for (int i = 1; i < m_results.size(); i++) {
> 33 +

Removed the line and also changed "j -= 1" to "j--" as that was bothering me as well :-)

Revision history for this message
Andrea Cimitan (cimi) wrote :

Finally managed to test it on my laptop (I wasn't able to run unity8 on my laptop due to deps and such), confirm it solve the slow reordering issue

review: Approve

Unmerged revisions

356. By Josh Arenson

Clean syntax

355. By Josh Arenson

Fix the list sorting of overviewresults

When the results for the model were set, the loop responsible for sorting them
was being executed hundreds of thousands of times. It has been replaced with a
simple insertion sort.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: