Skip to content

Commit

Permalink
[SPARK-21254] [WebUI] Performance improvements: detaching DOM before …
Browse files Browse the repository at this point in the history
…DataTables plugin processing

Detaching history table wrapper from document before parsing it with DataTables plugin
and reattaching back right after plugin has processed nested DOM. This allows to avoid
huge amount of browser repaints and reflows, reducing initial page load time in Chrome
from 15s to 4s for 20k+ rows
  • Loading branch information
2ooom committed Aug 6, 2017
1 parent 9169707 commit 3630ca2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ $(document).ready(function() {
}

$.get("static/historypage-template.html", function(template) {
var sibling = historySummary.prev();
historySummary.detach();
var apps = $(Mustache.render($(template).filter("#history-summary-template").html(),data));
var selector = "#history-summary-table";
var attemptIdColumnName = 'attemptId';
var startedColumnName = 'started';
var defaultSortColumn = completedColumnName = 'completed';
Expand Down Expand Up @@ -192,7 +193,8 @@ $(document).ready(function() {
{"searchable": false, "targets": [getColumnIndex(conf.columns, durationColumnName)]}
];
historySummary.append(apps);
$(selector).DataTable(conf);
apps.DataTable(conf);
sibling.after(historySummary);
$('#history-summary [data-toggle="tooltip"]').tooltip();
});
});
Expand Down

0 comments on commit 3630ca2

Please sign in to comment.