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:
,
Mar 6 2017
I can set up a WebEx session, or you can connect to my computer in a different way, if that helps.
,
Mar 7 2017
,
Apr 5 2017
compiler people, what do you think?
,
Apr 5 2017
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.
,
Apr 6 2017
Thanks, setting for WontFix according to #5.
,
Apr 6 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by dglazkov@chromium.org
, Mar 6 2017