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

Replace Naive Tooltip Lookup with d3-quadtree #1

Open
hydrosquall opened this issue Nov 20, 2018 · 1 comment
Open

Replace Naive Tooltip Lookup with d3-quadtree #1

hydrosquall opened this issue Nov 20, 2018 · 1 comment

Comments

@hydrosquall
Copy link
Owner

hydrosquall commented Nov 20, 2018

Right now, we loop over every single satellite. This is not as efficient as it could be.

We can reduce the expensiveness of this computation by precomputing a data structure that reveals what points are closest to the mouse pointer.

  • Building the quadtree up front
  • On each mouse movement, only check if we are overlapping with the closest satellite, avoiding the need to compare against every single satellite.

This should reduce perceived lagginess when someone is interacting with the visualization.

The relevant area of code to optimize would be around this line:

// TODO: speed up the element lookup with a d3 quadtree

@hydrosquall
Copy link
Owner Author

(After looking into this briefly, the refactor that would make sense to do before this one:

  1. Do away with the nested "cats" data structure, and store all the satellites in a single flat array
  2. Store x/y position directly on the satellite instead of keeping it in a separate data structure to avoid the need for passing around extra objects

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

No branches or pull requests

1 participant