Skip to content
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

Improve stacking performance and footprint #6762

Merged
merged 3 commits into from
Nov 18, 2019

Conversation

kurkle
Copy link
Member

@kurkle kurkle commented Nov 18, 2019

Performance

Master

image

PR

image

About ~200ms improvement overall in uPlot stacked (~950ms -> ~750ms).

Memory

Master

image

PR

image

const dataset = me.getDataset();
const xid = meta.xAxisID = dataset.xAxisID || getFirstScaleId(chart, 'x');
const yid = meta.yAxisID = dataset.yAxisID || getFirstScaleId(chart, 'y');
meta.xScale = me.getScaleForId(xid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a really good idea!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we should store iScale and vScale here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably

src/controllers/controller.line.js Show resolved Hide resolved
const dataset = me.getDataset();
const xid = meta.xAxisID = dataset.xAxisID || getFirstScaleId(chart, 'x');
const yid = meta.yAxisID = dataset.yAxisID || getFirstScaleId(chart, 'y');
meta.xScale = me.getScaleForId(xid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we should store iScale and vScale here as well?

@kurkle
Copy link
Member Author

kurkle commented Nov 18, 2019

Forgot to mention the leading idea: in _parsed, store reference to the stack object instead of the key that leads to it.

@kurkle
Copy link
Member Author

kurkle commented Nov 18, 2019

Added vScale / iScale. Also replaced getMeta() with _cachedMeta. Updated bunch of var to const / let. Not by all means complete on those var's. I can remove those, if its too much to review.

@etimberg etimberg merged commit e5b03a0 into chartjs:master Nov 18, 2019
@etimberg etimberg added this to the Version 3.0 milestone Nov 18, 2019
@kurkle kurkle deleted the improve-stacking branch December 7, 2019 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants