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

Fix excessive redraw #12931

Merged
merged 1 commit into from
Jul 20, 2017

Conversation

thomasneirynck
Copy link
Contributor

@thomasneirynck thomasneirynck commented Jul 17, 2017

Closes #12919.

This changes a couple of things for efficiency.

  • do not rerun the response handler when the request-response has not changed (this closes 12919). (note that the update_status serialization did not catch that no-data was changed, because the response-handler was called every time).
  • make the updateExtent handler a little more efficient. do not update the layer if no changes in the bounds.

@thomasneirynck thomasneirynck requested a review from ppisljar July 17, 2017 23:28
@thomasneirynck thomasneirynck added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) review v6.0.0-beta1 labels Jul 17, 2017
notify.error(e);
})
.then(resp => {
window._old.push($scope.visData);
Copy link
Member

Choose a reason for hiding this comment

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

this seems wrong :) (adding stuff to window object)

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

mostly i have some questions and some minor comments

.then(resp => responseHandler($scope.vis, resp), e => {
.then(requestHandlerResponse => {
if ($scope.requestHandlerResponse && $scope.requestHandlerResponse === requestHandlerResponse) {
//we do not need to call the response handler, since there have been no data changes
Copy link
Member

Choose a reason for hiding this comment

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

thats not always the case. response handlers receive vis configuration as well, and they may produce different response based on that.

i don't see a reason for skipping this part, could you elaborate a bit ? all we do is save some resources, which shouldn't be that much anyway ...

if we are to skip it, we should make sure vis object didn't change as well ...

Copy link
Contributor Author

@thomasneirynck thomasneirynck Jul 18, 2017

Choose a reason for hiding this comment

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

In practice, this saves a new tabify on each ui-state change which happens all the time when panning/zooming the map. this also avoids reprocessing of the result to geojson on each change.

by skipping this, we can also rely on the status.data===false flag to NOT recreate the leaflet layer, because we know the data hasn't changed. This is an important part to keep the map responsive. If we do rerun the reponseHandler, the data flag becomes true (even though it is the same data).

This doesn't really affect other visualizations because they don't push on the ui-state frequently.

notify.error(e);
})
.then(resp => {
window._old.push($scope.visData);
window._current = resp;
Copy link
Member

Choose a reason for hiding this comment

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

where are this window props used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they're not, sorry for the cruft, forgot to remove them when debugging.

@thomasneirynck thomasneirynck changed the title Fix/excessive redraw Fix excessive redraw Jul 18, 2017
@thomasneirynck thomasneirynck force-pushed the fix/excessive_redraw branch 2 times, most recently from e859170 to 2c744cc Compare July 18, 2017 19:52
@thomasneirynck thomasneirynck requested a review from nreese July 19, 2017 16:54
small mods

remove debug statements

ensure we run responsHandle if changes in visConfig
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

LGTM, but i wonder:

  • tabify takes 2-5ms usually, up to 100ms sometimes with tons of data .... do we really need this ?
  • this would only apply to maps visualization ... and even there with the introduction of Filter geohash_grid aggregation to map view box with collar #12806 it won't be required anymore (we will actually want to request every time we pan around right ? )

@thomasneirynck
Copy link
Contributor Author

wrt second comment. not entirely, there's a buffer around the edge, so we don't really make a request at each pan and zoom, only when it crosses the buffer. plus, it's optional, so we preserve the old way of requesting as well and don't want to regress there.

wrt. first comment. yeah, that's inefficient, but we need for spy panel. should check if we can make this slimmer.

@thomasneirynck thomasneirynck merged commit cd4b7ff into elastic:master Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:fix review v6.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coordinates Map visualization re-creating geohashLayer on map move
4 participants