elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.6k stars 8.21k forks source link

[Lens][Visualize] Optimize rendering pipeling for high number of breakdown categories #158322

Open drewdaemon opened 1 year ago

drewdaemon commented 1 year ago

The fillColor routine in the partition vis renderer is called for every partition. In high-volume partition charts (e.g. top 500 terms), this becomes quite slow, relative to other rendering routines.

This slowdown can also show up in partition chart suggestions.

There's probably room to optimize fillColor to keep things snappy.

Screenshot 2023-05-23 at 3 04 47 PM

The same issue could be also reproduced in cartesian charts. To reproduce it in Lens:

The minimal amount of buckets I found to kick the slowness is 200 (buckets) x 200 (breakdown).

elasticmachine commented 1 year ago

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

dej611 commented 1 year ago

To reproduce this issue in Lens:

The minimal amount of buckets I found to kick the slowness is 200 (buckets) x 200 (breakdown).

With partition chart this is very easy to produce as bucketed operations can be nested up to 3 levels, so even smaller numbers can apply where 3 of them are used. The bigger problem here is that when the user hits one of these case with one chart type, the suggestion bar underneath will produce multiple chart types with similar effects producing big performance issues for the whole editor.

cc @markov00 @nickofthyme

markov00 commented 1 year ago

I see how this can lead to a performance issue, but in any case I feel that rendering a piechart or a barchart with such high cardinality of breakdown categories is clearly a bad practice and is a solution that should not be reached by the user. A numerous things can be done to speed up the implementation, but I don't feel we should spend our efforts to improve this bad case. My proposal is instead to spend time in:

markov00 commented 1 year ago

A chart in the suggestions is rendered in an area of 132x82 pixels.

A possible set of preferable configurations for the suggestions: