Improve spy tab performance on Discover (#9590)

Switching between tabs in the spy panel takes a really long time in the
Discover histogram. The root cause is that there is an expensive forced
layout happening. It's expensive because the "response" tab includes all
500 hits from the search response which is a lot of content. This
affects all the tabs because we're using ng-show instead of ng-if,
meaning we're incurring the cost of layout on all that content even when
it's not being shown. This PR switches to ng-if to speed up all of the
tabs other than "Response".

The response tab remains slow because the vis is re-rendered any time
uiState changes, and when the vis is re-rendered it triggers forced
reflows. This is a non-trivial issue to fix that Peter is already
working on separately, so for now we'll settle for only speeding up the
other tabs.

Fixes https://github.com/elastic/kibana/issues/9464
This commit is contained in:
Matt Bargar 2016-12-21 15:25:24 -05:00 committed by GitHub
parent cb67bc3e10
commit 899d560caf

View file

@ -10,25 +10,25 @@
<i class="fa fa-danger"></i> Request Failed
</div>
<div ng-show="spy.mode.name === 'request'">
<div ng-if="spy.mode.name === 'request'">
<label>
Elasticsearch request body &nbsp;
</label>
<pre>{{req.fetchParams.body | json}}</pre>
</div>
<div ng-show="spy.mode.name === 'response'">
<div ng-if="spy.mode.name === 'response'">
<label>
Elasticsearch response body &nbsp;
</label>
<pre>{{req.resp | json}}</pre>
</div>
<div ng-show="spy.mode.name === 'stats'">
<div ng-if="spy.mode.name === 'stats'">
<table class="table">
<tr ng-repeat="pair in stats">
<td>{{pair[0]}}</td>
<td>{{pair[1]}}</td>
</tr>
</table>
</div>
</div>