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

Animation refactor #377

Merged
merged 11 commits into from
Jul 10, 2017
Merged

Animation refactor #377

merged 11 commits into from
Jul 10, 2017

Conversation

trvrb
Copy link
Member

@trvrb trvrb commented Jul 8, 2017

Progress on #367

Before this branch (current master) if getting the following performance for Ebola:

  • ~230ms animation frames
  • ~20ms getLatLongs

With this branch in place I'm getting:

  • ~190ms animation frames
  • ~10ms getLatLongs
  • ~50ms updateVisibility

Before this branch (current master) if getting the following performance for 3y flu region resolution:

  • ~400ms animation frames
  • ~45ms getLatLongs

With this branch in place I'm getting:

  • ~270ms animation frames
  • ~15ms getLatLongs
  • ~150ms updateVisibility

Going to keep updating these numbers as I work on the PR. Serving to help me remember if there's performance increases.

@trvrb
Copy link
Member Author

trvrb commented Jul 9, 2017

Okay. I think I'm done with this for the moment (and need to shift gears for the next couple days). @colinmegill: I tried to clean up code where possible, things like:

  • replacing things like long0 with longOrig, long1 with longDest and winningPair with closestPair to make self documenting
  • don't pass around high-level redux object controls to things like updateVisibility that have to be reached into and instead pass in low-level numDates.
  • carve out functions for leafletLatLongToLayerPoint and maybeGetTransmissionPair to reduce code duplication

Biggest functional change is duplicating map with adding a half map to the west and a half map to the east, rather than the full triplicating. This improves performance and provides a more natural set of bounds.

This is just FYI for @colinmegill, but @jameshadfield could you do a quick review on Monday and merge if it looks good.

@jameshadfield
Copy link
Member

Looks good to me - i've made some comments in issue #367

Will let @colinmegill take a look, but I plan to merge later this afternoon (since animation is currently disabled in master anyway)

@colinmegill
Copy link
Collaborator

colinmegill commented Jul 10, 2017 via email

@trvrb
Copy link
Member Author

trvrb commented Jul 10, 2017

Great. Thanks both.

@@ -488,38 +497,6 @@ class Map extends React.Component {
}
}, animationTick);

// controls: state.controls,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment can stay, I will clean up on the requestAnimationFrame pass

@@ -25,18 +24,16 @@ import {
// datasetGuid: state.tree.datasetGuid,
treeVersion: state.tree.version,
treeLoaded: state.tree.loaded,
controls: state.controls,
splitTreeAndMap: state.controls.splitTreeAndMap,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is way cleaner

location: key, // Thailand:
total: value.length, // 20, this is an array of all demes of a certain type
color: averageColors(value),
coords: leafletLatLongToLayerPoint(lat, long, map)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This (apparently, but I could be wrong here) no longer relies on new L.LatLng, is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did this to reduce code duplication. leafletLatLongToLayerPoint should be handing back a new L.LatLng(lat, long) in the exact same fashion as before, just shelved out into a function.

@colinmegill
Copy link
Collaborator

All set - this is looking great

@trvrb
Copy link
Member Author

trvrb commented Jul 10, 2017

These changes look good James.

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.

3 participants