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

scaleQuantile performance fixup #224

Merged
merged 1 commit into from
Sep 23, 2020
Merged

scaleQuantile performance fixup #224

merged 1 commit into from
Sep 23, 2020

Conversation

ilijapuaca
Copy link
Contributor

We've noticed a significant performance drop since upgrading to newer version of d3-scale. Based on profiling that we've done it was apparent that scaleQuantile was taking much longer to complete for the same input.

By inspecting the code it looks like it's calling out to d3-array::quantile, which creates a copy of the array (640k entries in our case) and re-sorts it each time. Since our input is already sorted, and the previous version of this function did not do in-place sorting, using d3-array::quantileSorted instead of d3-array::quantile gets the performance back to regular execution times.

d3-array added quantileSorted in this commit, I assume this update is an expected outcome as it restores the behavior it had prior to this change.

@mbostock mbostock merged commit 42d546e into d3:master Sep 23, 2020
@mbostock
Copy link
Member

This is missing a change to package.json: if we adopt quantileSorted, then we need d3-array 2.3.0 or higher. I’ll fix.

@ilijapuaca
Copy link
Contributor Author

Just realized it should be bumped, but I see that you're already ahead of me and published a new release as well. That was fast, thank you!

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

Successfully merging this pull request may close these issues.

3 participants