New issue
Advanced search Search tips

Issue 615488 link

Starred by 9 users

Issue metadata

Status: Duplicate
Merged: issue 620142
Owner:
Closed: Jun 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

JS/DOM Slowness Issue

Reported by rasmita....@gmail.com, May 27 2016

Issue description

Chrome Version       : 51.0.2704.63 m

We are facing browser slowness for our system. On of our main page is heavily using Ajax calls to our server. This was not an issue in Chrome 50 version.

we did a basic developer test on the page and compared against Chrome 50. Its taking way much time for the JS/DOM and 90% of the time is spent in Script processing.

Our application is dedicated for Chrome browsers and our medical partners are having issues for this.

Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari: OK
    Firefox: OK
         IE: OK

What steps will reproduce the problem?
(1) Page with dropdown making ajax call to populate the list

 
Chrome51 _JSDOM.jpg
111 KB View Download
Labels: Needs-Feedback
Can you also please provide the OS details to reproduce the issue ?

Also please provide the sample URL so that we can try it at our end ?
Hi,

This issue is happening for our production system and we cant share the URL for this. 

It happens for any OS configuration for a bulk load on any drop down.

Project Member

Comment 3 by sheriffbot@chromium.org, Jun 1 2016

Labels: -Needs-Feedback Needs-Review
Owner: pucchakayala@chromium.org
Thank you for providing more feedback. Adding requester "pucchakayala@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Hi,

Is there any update on this. Most of our partners are facing this issue currently.

Comment 5 by lbe...@gmail.com, Jun 10 2016

Hello,

I've just sent an email to the owner of this bug, and wanted to also include those comments on this issue. We have produced a demo of the behavior here: https://chromiumdemo.build.itransplant.net/.

Additionally, we have captured video of the behavior in Chrome 50 here: http://screencast.com/t/2tYDrlInk (note how there is very little time spent processing), while in Chrome 51 here: http://screencast.com/t/jT074W6I  there is a significant amount of time where the UI is completely locked up.

I have attached JS timelines captured in Chrome 50 and 51 (they had to be zipped due to the max attachment size).

Please reach out with any questions you have as this issue is having a very heavy impact on virtually all of our clients who have upgraded Chrome.

Thanks!

chromium_bug.zip
2.5 MB Download
Cc: cbiesin...@chromium.org
Could you produce a trace as per https://www.chromium.org/developers/how-tos/submitting-a-performance-bug and attach it to this bug? Thanks!

Comment 7 by phistuck@gmail.com, Jun 14 2016

I vaguely remember a recent fix for removeChild... Can you try the canary and see if it is still so slow?
It installs side by side with stable Chrome, but it updates almost daily with a very recent (and not so tested) Chrome -
https://www.google.com/chrome/browser/canary.html

Comment 8 by phistuck@gmail.com, Jun 14 2016

Also, as a quick workaround, since adding options is much faster than removing them, perhaps clear the contents of the <select> at once (selectElement.innerHTML = "" or using jQuery - $(selectElement).empty()) and re-add the options instead?

Comment 9 by lbe...@gmail.com, Jun 14 2016

As requested, here is a trace I just took in chrome 51.
trace_Tue_Jun_14_2016_9.55.14_AM.json.gz
5.8 MB Download

Comment 10 by lbe...@gmail.com, Jun 14 2016

@phistuck: The performance is the same in Canary, although the initial load of the select box works somewhat quicker. 

Regarding using $(selectElement).empty(), we already invoke that prior to adding the new elements to the list (I annotated the source here):

function bindContact1() {
        $.getJSON("contacts.json", function (data) {
            var contacts = data['contacts'];
            $("#dropDownContact")
                .empty() // empty this list and then add the null element.
                .append($('<option></option>').val(null).html("------"));

            //Append each data from the contacts.json
            $.each(contacts, function (key, value) {
                var option = $('<option />').val(value.id).text(value.name);
                $("#dropDownContact").append(option);
            });

        });
    }

Thanks for the idea though.

Comment 11 by phistuck@gmail.com, Jun 14 2016

Sorry, that was a bad advice, because $().empty() calls removeChild. I thought it was just emptying the innerHTML.
So using selectElement.innerHTML = "" (or $jQuerySelectElement[0].innerHTML = "") should really speed this up.

Comment 12 by lbe...@gmail.com, Jun 14 2016

@phistuck thanks for the ideas, but unfortunately they didn't help out the performance issue in Chrome 51 or Canary. 

Hopefully there is a way to address the core issue of this performance regression in Chrome.

Comment 13 by phistuck@gmail.com, Jun 14 2016

Sorry, I should have checked that before giving you the advise. :(
I guess behind the scenes, setting innerHTML = "" goes through a similar code path as removeChild and thus remains slow. :(

Comment 14 by lbe...@gmail.com, Jun 15 2016

It appears that someone else has logged a similiar issue here (possibly a duplicate of this issue): https://bugs.chromium.org/p/chromium/issues/detail?id=620142.
Mergedinto: 620142
Status: Duplicate (was: Unconfirmed)
Merging into that one, since it has a smaller and more reduced test case.
I got the same exact issue, what took 100ms before takes now 4000-5000ms to remove few hundreds of <option> in a <select> menu. Our system became so slow that I had to bring that quickfix as a work around (replacing the whole select with another one similar but with the new values) :

var replacingSelect = '<select id="foo"><option value="0">Some value</option></select>';
$('#foo').replaceWith(replacingSelect);

Adding <option> itself isn't an expensive operation, it's very specifically emptying (or refilling) a <select> object with innerHTML and removeChild() methods. Of course.

Comment 17 by phistuck@gmail.com, Jun 20 2016

Yep, we know, see the issue into which this issue was merged.

Sign in to add a comment