Skip to content

Conversation

@superbobry
Copy link

Currently all the DOM manipulations are handled in a loop after Mustache
template is parsed. This causes severe performance issues especially within
loops iteration over thousands of (attempt/application) records and causing
all kinds of unnecessary browser work: reflow, repaint, etc.

This could be easily fixed by preparing a DOM node beforehand and doing all
manipulations within the loops on detached node, reattaching it to the document
only after the work is done.

The most costly operation in this case was setting innerHTML for duration
column within a loop, which is extremely unperformant:

https://jsperf.com/jquery-append-vs-html-list-performance/24

While duration parsing could be done before mustache-template processing without
any additional DOM alteratoins.

Signed-off-by: Sergei Lebedev [email protected]

Currently all the DOM manipulations are handled in a loop after Mustache
template is parsed. This causes severe performance issues especially within
loops iteration over thousands of (attempt/application) records and causing
all kinds of unnecessary browser work: reflow, repaint, etc.

This could be easily fixed by preparing a DOM node beforehand and doing all
manipulations within the loops on detached node, reattaching it to the document
only after the work is done.

The most costly operation in this case was setting innerHTML for `duration`
column within a loop, which is extremely unperformant:

https://jsperf.com/jquery-append-vs-html-list-performance/24

While duration parsing could be done before mustache-template processing without
any additional DOM alteratoins.

Signed-off-by: Sergei Lebedev <[email protected]>
@AnnaSavarin
Copy link

From Lake's perspective, this patch works; however, a +1 from a UI person would help.

@AnnaSavarin
Copy link

Approved by frontdevguild.

@AnnaSavarin AnnaSavarin merged commit 758cca1 into criteo-2.1 Jun 6, 2017
@superbobry superbobry deleted the shs-ui-perf-fix branch June 12, 2017 10:56
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.

4 participants