New issue
Advanced search Search tips

Issue 698415 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Dramatic delays in running a method depending on its text, e.g. adding 1 character to a comment adds 20ms

Reported by serggu...@gmail.com, Mar 3 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
This is an extremely strange bug. I spent 2 days trying to narrow it down.

In a complex javascript application I have the following method:

        SheetItem.prototype.markChanged = function () {
            // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            if (!this.trackChanges) {
                return;
            }
            //var status = ItemStatus.Intact;
            //if (status === ItemStatus.Intact)
            //{
            //    //this.status(ItemStatus.Changed);
            if (this.status.peek() === ItemStatus.Intact) {
                this.status(ItemStatus.Changed);
            }
        };

It does not do anything and still takes 20ms to complete, so it hangs the system when called 10 000 times. If I just add another character at the end of the first comment, e.g. 'B':

        SheetItem.prototype.markChanged = function () {
            // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaB
            // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            if (!this.trackChanges) {
                return;
            }
            //var status = ItemStatus.Intact;
            //if (status === ItemStatus.Intact)
            //{
            //    //this.status(ItemStatus.Changed);
            if (this.status.peek() === ItemStatus.Intact) {
                this.status(ItemStatus.Changed);
            }
        };

, it starts working fine. All other subtle changes to the text of the method cause dramatic changes to the timing as well. It makes 2 calls to other methods, but I had a version that would take 20ms to run without any external calls.

Also, if I put a breakpoint in the method, run to it and then remove it and press F8, the method starts working fine.

All the above depends on the current context of the application. If I let the operation complete, which takes 3 min (20ms * 10000 = 200 sec), next time I run it, it works fine (the method takes 0ms).

Apparently, it is virtually impossible for you to reproduce the bug without having the whole system in your development environment.

What is the expected behavior?
Adding 1 character to a comment should not change the execution time by million times

What went wrong?
See above

Did this work before? N/A 

Chrome version: 56.0.2924.87  Channel: stable
OS Version: 10.0
Flash Version:

 
Components: -Blink Blink>JavaScript>Compiler
The specific way in which you worked around it makes me wonder if this is a V8 compiler issue.

However, I am unable to confirm the problem without a working repro case. Handing this over to V8 folks so that they could chat more with you about the specifics of the issue.
I can set up a WebEx session, or you can connect to my computer in a different way, if that helps.
Labels: TE-NeedsTriageHelp
Cc: bmeu...@chromium.org mvstan...@chromium.org
compiler people, what do you think?
Cc: tebbi@chromium.org jarin@chromium.org mstarzinger@chromium.org
It sounds a lot like this is related to the text size inlining limit of Crankshaft.  You could play with the --max_inlined_source_size command line flag, which defaults to 600 (matching your character count). Try to change it by passing --js-flags="--max_inlined_source_size=XXX" to chrome (see https://www.chromium.org/developers/how-tos/run-chromium-with-flags).

You could also try with M59 Canary/Dev and forcibly enable Ignition and TurboFan (see https://v8project.blogspot.com/2017/02/help-us-test-future-of-v8.html); since TurboFan doesn't have this weird limit, the problem shouldn't repro there.
Status: WontFix (was: Unconfirmed)
Thanks, setting for WontFix according to #5.
Cc: hablich@chromium.org

Sign in to add a comment