Merge lp:~josharenson/unity-scopes-shell/fix-overview-results-sorting into lp:unity-scopes-shell
| Status: | Approved |
|---|---|
| Approved by: | Paweł Stołowski on 2016-12-16 |
| Approved revision: | 355 |
| Proposed branch: | lp:~josharenson/unity-scopes-shell/fix-overview-results-sorting |
| Merge into: | lp: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:~josharenson/unity-scopes-shell/fix-overview-results-sorting |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Andrea Cimitan (community) | 2016-12-12 | Approve on 2016-12-19 | |
| Paweł Stołowski | Approve on 2016-12-16 | ||
|
Review via email:
|
|||
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.
- 356. By Josh Arenson on 2016-12-16
-
Clean syntax
| 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 :-)
| 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
Unmerged revisions
- 356. By Josh Arenson on 2016-12-16
-
Clean syntax
- 355. By Josh Arenson on 2016-12-12
-
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.

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 +