Closed
Bug 920561
Opened 11 years ago
Closed 11 years ago
Ensure LazyLoader.load does not slow down app rendering
Categories
(Firefox OS Graveyard :: Gaia, defect)
Firefox OS Graveyard
Gaia
Tracking
(Not tracked)
RESOLVED
FIXED
1.3 Sprint 3 - 10/25
People
(Reporter: vingtetun, Assigned: vingtetun)
References
Details
(Keywords: perf, Whiteboard: [c=progress p= s= u=1.3])
Attachments
(1 file, 2 obsolete files)
1.94 KB,
patch
|
kaze
:
review+
etienne
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #809915 -
Flags: review?(mbudzynski)
Updated•11 years ago
|
Attachment #809915 -
Flags: review?(mbudzynski) → review+
Comment 2•11 years ago
|
||
R+ me, thanks.
Assignee | ||
Comment 3•11 years ago
|
||
https://github.com/mozilla-b2g/gaia/commit/6dcb079db2ad16a2b2995c039f358ff9d6a2f6d4
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 4•11 years ago
|
||
I'm sorry, but this introduced unit test failures such as: 1) [communications-contacts] "before each" hook: Error: TypeError: Contacts.extServices.showDuplicateContacts is not a function (http://communications.gaiamobile.org:8080/contacts/js/views/form.js?time=1380145158658:535) at onerror (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4959) So I backed out: https://github.com/mozilla-b2g/gaia/commit/56b68fc51500cc0415f288ab939cd86e92f1fdc6
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 5•11 years ago
|
||
Is there a specific app that is having problems? In calendar for example I believe we do a setTimeout(fn, 0) to lazy load what's required. I'm wondering if we should handle this on a per-app level. I was also worried about having the 4ms minimum wait when we don't want it if we always call this.
Flags: needinfo?(21)
Assignee | ||
Comment 6•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #5) > Is there a specific app that is having problems? In calendar for example I > believe we do a setTimeout(fn, 0) to lazy load what's required. I'm > wondering if we should handle this on a per-app level. I was also worried > about having the 4ms minimum wait when we don't want it if we always call > this. Settings and likely clock. But I suspect others as well.
Flags: needinfo?(21)
Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #5) > Is there a specific app that is having problems? In calendar for example I > believe we do a setTimeout(fn, 0) to lazy load what's required. I'm > wondering if we should handle this on a per-app level. I was also worried > about having the 4ms minimum wait when we don't want it if we always call > this. Also it should not be an additional 4ms delay if those are not nested, isn't it?
Comment 8•11 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #6) > Settings and likely clock. But I suspect others as well. Not fully against landing this, but I would rather handle this per app, or make sure there's no "4ms minimum" for nested calls where it's used in other apps.
Assignee | ||
Comment 9•11 years ago
|
||
Seems to fix the contacts red.
Comment 10•11 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #7) > (In reply to Kevin Grandon :kgrandon from comment #5) > > Is there a specific app that is having problems? In calendar for example I > > believe we do a setTimeout(fn, 0) to lazy load what's required. I'm > > wondering if we should handle this on a per-app level. I was also worried > > about having the 4ms minimum wait when we don't want it if we always call > > this. > > Also it should not be an additional 4ms delay if those are not nested, isn't > it? Correct, but I feel like apps may already be calling it in a setTimeout(). Calendar definitely used to for example.
Assignee | ||
Comment 11•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #10) > (In reply to Vivien Nicolas (:vingtetun) (:21) from comment #7) > > (In reply to Kevin Grandon :kgrandon from comment #5) > > > Is there a specific app that is having problems? In calendar for example I > > > believe we do a setTimeout(fn, 0) to lazy load what's required. I'm > > > wondering if we should handle this on a per-app level. I was also worried > > > about having the 4ms minimum wait when we don't want it if we always call > > > this. > > > > Also it should not be an additional 4ms delay if those are not nested, isn't > > it? > > Correct, but I feel like apps may already be calling it in a setTimeout(). > Calendar definitely used to for example. I would be fine to remove the setTimeout(fn, 0) from other apps (in a followup) to avoid the extra 4ms if you want. But it sounds saner to enforce that at the library level since LazyLoad as a name tends to make people think that will be loaded later! (we're replying very closely, just mid-air collision you!)
Assignee | ||
Updated•11 years ago
|
Attachment #810260 -
Flags: review?(kgrandon)
Assignee | ||
Comment 12•11 years ago
|
||
The dialer seems to layzload in the onload handler directly too.
Comment 13•11 years ago
|
||
Comment on attachment 809915 [details] [diff] [review] lazyloader.not.in.load.path.patch Review of attachment 809915 [details] [diff] [review]: ----------------------------------------------------------------- I am fine moving this into the library. ::: shared/js/lazy_loader.js @@ +23,5 @@ > + // we wait in the window manager to remove the cover and show > + // the app itself. setTimeout here ensure that the load event > + // is fired before we load those additional scripts that are > + // not needed for displaying quickly the app. > + setTimeout(function(self) { If we're going to land this again, perhaps we could make a few updates? 1 - Platform standard is no anon functions, so call this nextTick or something. 2 - Can we consolidate setTimeout calls around the parent method here: https://github.com/mozilla-b2g/gaia/blob/master/shared/js/lazy_loader.js#L94
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #13) > Comment on attachment 809915 [details] [diff] [review] > lazyloader.not.in.load.path.patch > > Review of attachment 809915 [details] [diff] [review]: > ----------------------------------------------------------------- > > I am fine moving this into the library. > > ::: shared/js/lazy_loader.js > @@ +23,5 @@ > > + // we wait in the window manager to remove the cover and show > > + // the app itself. setTimeout here ensure that the load event > > + // is fired before we load those additional scripts that are > > + // not needed for displaying quickly the app. > > + setTimeout(function(self) { > > If we're going to land this again, perhaps we could make a few updates? > > 1 - Platform standard is no anon functions, so call this nextTick or > something. Oh man I fight so much for that and I'm caught doing it! thanks :) > > 2 - Can we consolidate setTimeout calls around the parent method here: > https://github.com/mozilla-b2g/gaia/blob/master/shared/js/lazy_loader.js#L94 Sure. That sounds saner in fact.
Comment 15•11 years ago
|
||
Comment on attachment 810260 [details] [diff] [review] test.contact.patch Review of attachment 810260 [details] [diff] [review]: ----------------------------------------------------------------- This looks fine to be assuming all contacts tests pass :) Please ensure this doesn't cause any defects in travis before landing. Thanks!!
Attachment #810260 -
Flags: review?(kgrandon) → review+
Updated•11 years ago
|
Assignee: nobody → 21
Whiteboard: [c= p= s= u=] → [c=progress p= s= u=]
Assignee | ||
Comment 16•11 years ago
|
||
https://github.com/mozilla-b2g/gaia/commit/8ed692c6c6df1fcabe3c65ca8fee9cd54e625244 Pushed again. Time for me to sleep.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 17•11 years ago
|
||
https://github.com/mozilla-b2g/gaia/commit/ca776d1bb0fb1da21b624624892f3930e3ae800a I didn't broke the tests, they were green but many apps were broken... backouting myself.
Assignee | ||
Updated•11 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 18•11 years ago
|
||
Ack! What kind of issues were you seeing? I wonder if me suggesting moving the setTimeout caused the failures? Perhaps some applications were thinking that it was ok to consider that the dom loader would be synchronous. Currently it has an asynchronous interface, but only uncomments the text content - so it's *possible* to use synchronously. If that's the case, I'm ok going back to your original setTimeout around just JS and CSS. Sorry!
Assignee | ||
Comment 19•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #18) > Ack! What kind of issues were you seeing? > > I wonder if me suggesting moving the setTimeout caused the failures? Perhaps > some applications were thinking that it was ok to consider that the dom > loader would be synchronous. Currently it has an asynchronous interface, but > only uncomments the text content - so it's *possible* to use synchronously. > If that's the case, I'm ok going back to your original setTimeout around > just JS and CSS. Sorry! I wonder if this is related to the html import stuff that became asynchronous now and was setTimeouted too. I will redo the patch with the old try and check on travis (i'm running it locally since this night and it seems fine)
Comment 20•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/312f40a7ce25
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Comment 21•11 years ago
|
||
oh sorry (and thanks to bkelly) this was backed out later in https://hg.mozilla.org/mozilla-central/rev/f029fc8f001b
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 22•11 years ago
|
||
Let's do that per app to not break all the tests then...
Attachment #809915 -
Attachment is obsolete: true
Attachment #810260 -
Attachment is obsolete: true
Attachment #816669 -
Flags: review?(kaze)
Attachment #816669 -
Flags: review?(etienne)
Updated•11 years ago
|
Target Milestone: --- → 1.2 C3(Oct25)
Comment 23•11 years ago
|
||
Comment on attachment 816669 [details] [diff] [review] lazyload.patch Review of attachment 816669 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nit for the dialer part ::: apps/communications/dialer/js/dialer.js @@ +16,4 @@ > window.addEventListener('load', function getSettingsListener() { > window.removeEventListener('load', getSettingsListener); > > + setTimeout(function() { `setTimeout(function nextTick() {`
Attachment #816669 -
Flags: review?(etienne) → review+
Assignee | ||
Comment 24•11 years ago
|
||
(In reply to Etienne Segonzac (:etienne) from comment #23) > Comment on attachment 816669 [details] [diff] [review] > lazyload.patch > > Review of attachment 816669 [details] [diff] [review]: > ----------------------------------------------------------------- > > r=me with nit for the dialer part > > ::: apps/communications/dialer/js/dialer.js > @@ +16,4 @@ > > window.addEventListener('load', function getSettingsListener() { > > window.removeEventListener('load', getSettingsListener); > > > > + setTimeout(function() { > > `setTimeout(function nextTick() {` Shame on me.
Comment 25•11 years ago
|
||
Comment on attachment 816669 [details] [diff] [review] lazyload.patch Looks OK to me, but this patch lets me think that we should probably make LazyLoader.load() asynchronous instead of putting every `LazyLoader.load()' statement in a setTimeout. I understand we don’t want to modify this right now, but maybe we should open a follow-up bug for this?
Attachment #816669 -
Flags: review?(kaze) → review+
Assignee | ||
Comment 26•11 years ago
|
||
(In reply to Fabien Cazenave [:kaze] from comment #25) > Comment on attachment 816669 [details] [diff] [review] > lazyload.patch > > Looks OK to me, but this patch lets me think that we should probably make > LazyLoader.load() asynchronous instead of putting every `LazyLoader.load()' > statement in a setTimeout. > Yep. That was my first suggestions but it needs more investigation for tests... I openeed bug 926851. https://github.com/mozilla-b2g/gaia/commit/95862b40ecd724d75057be4c4d5dc8578ad58c0b
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 27•11 years ago
|
||
Mike you may want this one for settings in koi.
Flags: needinfo?(mlee)
Assignee | ||
Comment 28•11 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #27) > Mike you may want this one for settings in koi. If you look at datazilla this week, this one is the stuff that has move settings next to calendar.
Comment 29•11 years ago
|
||
Thanks Vivien. That's a great improvement! Our perf numbers for 1.2 look good so let's pick this improvement up in 1.3.
Flags: needinfo?(mlee)
Whiteboard: [c=progress p= s= u=] → [c=progress p= s= u=1.3]
Target Milestone: 1.2 C3(Oct25) → 1.3 Sprint 3 - 10/25
You need to log in
before you can comment on or make changes to this bug.
Description
•