Skip to content

Commit 3630ca2

Browse files
committed
[SPARK-21254] [WebUI] Performance improvements: detaching DOM before 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
1 parent 9169707 commit 3630ca2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/resources/org/apache/spark/ui/static/historypage.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ $(document).ready(function() {
152152
}
153153

154154
$.get("static/historypage-template.html", function(template) {
155+
var sibling = historySummary.prev();
156+
historySummary.detach();
155157
var apps = $(Mustache.render($(template).filter("#history-summary-template").html(),data));
156-
var selector = "#history-summary-table";
157158
var attemptIdColumnName = 'attemptId';
158159
var startedColumnName = 'started';
159160
var defaultSortColumn = completedColumnName = 'completed';
@@ -192,7 +193,8 @@ $(document).ready(function() {
192193
{"searchable": false, "targets": [getColumnIndex(conf.columns, durationColumnName)]}
193194
];
194195
historySummary.append(apps);
195-
$(selector).DataTable(conf);
196+
apps.DataTable(conf);
197+
sibling.after(historySummary);
196198
$('#history-summary [data-toggle="tooltip"]').tooltip();
197199
});
198200
});

0 commit comments

Comments
 (0)