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

heatmap filtering example is astonishingly slow #649

Closed
gordonwoodhull opened this issue Jul 20, 2014 · 3 comments
Closed

heatmap filtering example is astonishingly slow #649

gordonwoodhull opened this issue Jul 20, 2014 · 3 comments
Labels
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

There is not that much data here. Is it just the example?

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Jul 20, 2014
@ralphrecto
Copy link

The way the heatmap implements a filter on an entire axis is to simply call the base filter() function on each cell in the axis. As you can imagine, this is prohibitively slow on even small data sets given that this performs a filter action on the underlying crossfilter object itself. Ideally, the list of values on the axis should be appended to the chart's internal filter values list, and then the chart's filter action should be triggered, as it packages all of the filter values on that internal list into one filterFunction call on the crossfilter - performing a filter on the crossfilter 1 time, rather than k times (where k is the number of cells in an axis).

Here's an immediate, monkey-patching solution. If you look at the heatmap source, you will see that the filter action on an axis is implemented in the filterAxis function, which is called by the x/yAxisOnClick function. Conveniently enough, you can set your own x/yAxisOnClick function. I suggest copying most of filterAxis and modifying the part that calls filter on each cell. You don't have direct access to the chart's internal filter values list, but you can modify it in place by calling chart.filters() and using the splice and push methods of JavaScript arrays.

@gordonwoodhull
Copy link
Contributor Author

Ah, that's a very good point. I had thought about combining the individual cells into a larger range, but just not calling filter so much would make a huge difference. There is a PR #557 which opens up the filter manipulation functions which may help here.

@gordonwoodhull
Copy link
Contributor Author

fixed in 2.0

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

No branches or pull requests

2 participants