New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run queued filters after generic filters making visualizations much faster #7387
Conversation
@@ -147,6 +147,8 @@ private function getLabelVariations($originalLabel) | |||
} | |||
$variations[] = $label; | |||
|
|||
$variations = array_unique($variations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small performance tweak for labelfilter
throw new PluginDeactivatedException($module); | ||
} | ||
$apiClassName = self::getClassNameAPI($module); | ||
$apiClassName = $this->getClassNameAPI($module); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this reverts https://github.com/piwik/piwik/pull/7344/files but that's not wanted
c4f6c61
to
3c3a11b
Compare
@@ -60,6 +62,16 @@ protected function getGoalMetrics(Row $row) | |||
$alternateKey = 'idgoal=' . $this->idGoal; | |||
if (isset($allGoalMetrics[$alternateKey])) { | |||
return $allGoalMetrics[$alternateKey]; | |||
} elseif ($this->idGoal === Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these if
statements fix a bug or add a new feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes ui tests as sometimes we have a string here and sometimes an integer / metric id. Wasn't needed before but now
Looks good! 👍 let's test it on demo |
Run queued filters after generic filters making visualizations much faster
When rendering a visualization, we applied queued filters, computed processed metrics, etc. always on all rows (meaning before generic filters were applied). This means when a datatable has 25k rows (which is not so much), then we ran
computeProcessedMetrics
,applyQueuedFilter
, ... on 25k rows instead of only 100 displayed rows. By changing this it made rendering a report with 25k rows over 3 seconds faster on my server. The time spent shrank to filter rows shrank from > 3 seconds to < 40ms.Also before this refactoring filters were applied in a completely random order which is entirely different to what we test in system tests resulting in different displayed data compared to what we test and compared to the exported data. Apart from that there was some duplicated code in applying filters in the visualization. We do now make sure to run the filters in the same order as we test it in system tests.
Note: Some UI tests are failing but only for some rows having the same value in the
filter_sort_column
. So it is not really a change, rather a fix since we do now apply the filters in the correct order.