Skip to content

Performance optimization for CategoryAxisRenderer: Avoid Forced Layouts#180

Open
strfry wants to merge 1 commit intojqPlot:masterfrom
strfry:bugfix/axis_performance
Open

Performance optimization for CategoryAxisRenderer: Avoid Forced Layouts#180
strfry wants to merge 1 commit intojqPlot:masterfrom
strfry:bugfix/axis_performance

Conversation

@strfry
Copy link
Copy Markdown

@strfry strfry commented Oct 17, 2018

I was hitting a performance issue, where a graph redraw with ~12000 elements took over 20 seconds to render on Firefox and Chrome. With the new optimization, it came down to a few seconds.
With their performance profilers, i traced this down to CategoryAxisRenderer. The combination of setting CSS ('left'), and getWidth() is triggering a layout recalculation for each of the 12000 elements.
This can be cut down to only a handful, when those elements with 0 width do not get positioned.

This could also be applicable to other AxisRenderers. There might be even a better way to ignore those axis ticks that are not rendererd anyway.

I didn't test beyond my application, so i can't say for sure that this code change is sound.

@johanbove
Copy link
Copy Markdown
Member

johanbove commented Oct 19, 2018

Thank you Jonathan! This looks like an awesome improvement to jqplot. Will need to investigate a little further.

Wondering if the css left call should be replaced with a translate call too?

@strfry
Copy link
Copy Markdown
Author

strfry commented Nov 26, 2018

@johanbove I'm not sure i understand what you mean.
Do you think the CSS 'translate' property would be a better way to achieve the same layout without dependent calculations on every frame?
I'm not very proficient in CSS, so i'm not sure what that would look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants