@tsteur opened this issue on July 28th 2015

fixes #7401

Made sort faster by using builtin php methods. Currently, we sort via usort in PHP. This is quite slow especially when we sort many rows, eg 25k rows or more. The time needed to sort depends a lot on the data, the column to sort, etc. that's why it is hard to say how much performance improvement we will gain. On 25k rows it can drop from eg before about 900ms to 500ms.

As a side effect the code is much better tested and it does now use a secondary column on either nb_visits or label if possible see #7401

The sort flags SORT_NATURAL and SORT_FLAG_CASE were added in PHP 5.4 which this pull request requires, therefore this goes into Piwik 3.0

Original PR was made in #7420

refs #4768

@tsteur commented on July 29th 2015

FYI: Need to rerun test once the UI test run on PHP 5.4 in this branch

@tsteur commented on July 29th 2015

One can see how the secondary column sort is quite useful. Eg here when rows are having same values it sorts by pageviews: http://builds-artifacts.piwik.org/ui-tests.fast_sort2/14483.7/ActionsDataTable_column_sorted and http://builds-artifacts.piwik.org/ui-tests.3.0/14505.7/GoalsTable_goals_table_ecommerce

Link to UI tests: http://builds-artifacts.piwik.org/ui-tests.3.0/14521.7/

@tsteur commented on July 30th 2015

The tests in SortTest that were in original PR were already merged previously. There are tests for Sorter class now to make sure it works as expected. The sort filter itself does not really contain any logic so did not add more tests as there are already

This issue was closed on August 18th 2015
Powered by GitHub Issue Mirror