-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
long chains without overflowing the stack fails on FF 10-23 #1622
long chains without overflowing the stack fails on FF 10-23 #1622
Conversation
@mbest Any thoughts on the best way to handle this? A few come to mind, and I had thought about putting a PR together but I noticed you had already done some work on this already and I'm sure would know better than I do where to start. The basic options seem to be:
I noted that the depth in the current test is 200, but is 10,000 in the patch. My personal inclination is towards a patch like #359, but I'd be gambling that there are no side-effects. |
While investigating this, I decided to run the test against previous versions to figure out when this started failing. It was working with Knockout 3.2.0, but not with 3.3.0. I'll look into it some more. |
…, especially for Firefox support (version 10-23).
63df63f
to
f3be8d5
Compare
// without the need to use "bind". Older versions of Firefox seem to use up a lot more stack space | ||
// when using a bound function or using "call". See #1622. | ||
var evaluationTimeoutInstance = null; | ||
computedObservable.evaluatePossiblyAsync = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This undoes the performance benefits of #1841; in most cases a closure will be more memory and slower than a function on the prototype chain, notably with newer browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're okay with the test failing in older FF, then we can simply ignore these changes and possibly skip the test for those browsers. After all, the test already failed with version 3.3.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with that, and as you say, going forward the use of deferred updates makes this issue go away. @SteveSanderson ?
I think then the answer might be to just reduce the number of iterations to 100. Legacy FF should pass with that (I think it succeeds with 130 or so, but not positive– if we go this route, I'll fix it up).
…PossiblyAsync; reduce recursion test depth to match success result in FF.
I've made a further commit to undo some of my previous changes. This keeps the logic of moving the "change" notification to |
Thanks @mbest – The updated PR looks good to me –– bearing in mind the caveat that I haven't stared at this enough to really understand any potential side-effects or pitfalls. |
…ion-stack-overhead long chains without overflowing the stack fails on FF 10-23
Thanks. I'm happy with it too. I've merged it now. |
I merged the above into the 1360-gulp branch, but as you can see there is still an odd continuing failure:
Firefox 17 and 24 pass; all three failed prior builds without this patch. Not sure why FF 38 would have this regression. |
I'll check that out. I had tested it with Firefox 16. |
Here's a jsFiddle to show stack depth FF 42 has a call stack of 200–262,000; Chrome is 8–20,000. FF 38.3.0esr has a call stack of 200–284,000 (On Mac OS X). May be a problem only on Linux? That'd be strange. |
The test Dependent Observable Should allow long chains without overflowing the stack fails on FF 10-23 with
InternalError: too much recusion
.Noting: #358 & #359.