-
Notifications
You must be signed in to change notification settings - Fork 287
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
Don't abuse timers #1108
Don't abuse timers #1108
Conversation
@chancancode to clarify, there was not a 300ms timer that fired infinitely. Updates were fired when the |
@rwwagner90 This is unrelated to how we update the render tree. This is just how we update the currently inspected object. When you call updateCurrentObject (which we always do in init as of now), at the end of the method, it will always unconditionally (even when there isn’t a current object) schedule a setTimeout that calls itself again, run-wrapped, which will then schedule another timer, etc. Worse, i think it’s actually possible to call this method multiple times and end up with a set of 300ms infinitely repeating timers. |
de58714
to
53b453d
Compare
Awesome! Really good work. |
Previously, the object inspector would schedule an infinite timer that fires every 300ms to update the current object (it actually fires even where there isn't a current object to update). This is extremely inefficient, and it causes a lot of extra work in big apps, since the timer starts a runloop which results in a full top-down revalidation. The more appropriate thing to do is tap into the runloop callbacks, since as far as Ember is concerned, if there are no runloops, there are no observable changes.
import { typeOf } from './utils/type-check'; | ||
|
||
const Ember = window.Ember; | ||
const { | ||
Object: EmberObject, inspect: emberInspect, meta: emberMeta, | ||
computed, get, set, guidFor, isNone, | ||
cacheFor, VERSION | ||
cacheFor, VERSION, run, |
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.
Thank you for not nesting this!
Previously, the object inspector would schedule an infinite timer that fires every 300ms to update the current object (it actually fires even where there isn't a current object to update). This is extremely inefficient, and it causes a lot of extra work in big apps, since the timer starts a runloop which results in a full top-down revalidation. The more appropriate thing to do is tap into the runloop callbacks, since as far as Ember is concerned, if there are no runloops, there are no observable changes.
Previously, the object inspector would schedule an infinite timer that fires every 300ms to update the current object (it actually fires even where there isn't a current object to update). This is extremely inefficient, and it causes a lot of extra work in big apps, since the timer starts a runloop which results in a full top-down revalidation. The more appropriate thing to do is tap into the runloop callbacks, since as far as Ember is concerned, if there are no runloops, there are no observable changes.
Previously, the object inspector would schedule an infinite timer that fires every 300ms to update the current object (it actually fires even where there isn't a current object to update). This is extremely inefficient, and it causes a lot of extra work in big apps, since the timer starts a runloop which results in a full top-down revalidation. The more appropriate thing to do is tap into the runloop callbacks, since as far as Ember is concerned, if there are no runloops, there are no observable changes.
Previously, the object inspector would schedule an infinite timer that fires every 300ms to update the current object (it actually fires even where there isn't a current object to update). This is extremely inefficient, and it causes a lot of extra work in big apps, since the timer starts a runloop which results in a full top-down revalidation. The more appropriate thing to do is tap into the runloop callbacks, since as far as Ember is concerned, if there are no runloops, there are no observable changes.
Split from #1088. I'll rebase that PR once this lands.