Closed Bug 841353 Opened 12 years ago Closed 12 years ago

'defer' more scripts

Categories

(Firefox OS Graveyard :: Gaia, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:tef+, b2g18+ fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)

RESOLVED FIXED
blocking-b2g tef+
Tracking Status
b2g18 + fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: vingtetun, Unassigned)

References

Details

(Keywords: verifyme, Whiteboard: [FFOS_perf] QARegressExclude)

Attachments

(2 files, 3 obsolete files)

Attached patch Patch (obsolete) — Splinter Review
In many apps more scripts can be defered in order to take advantage of the html5 parser.
Attachment #713889 - Flags: review?(etienne)
Attached patch Patch (obsolete) — Splinter Review
I forgot some debugging statements...
Assignee: nobody → 21
Attachment #713889 - Attachment is obsolete: true
Attachment #713889 - Flags: review?(etienne)
Attachment #713890 - Flags: review?(etienne)
Can you rebase your patch? I'd like to do a bit a testing and it's not applying properly.
Attached patch Patch (obsolete) — Splinter Review
Attachment #713890 - Attachment is obsolete: true
Attachment #713890 - Flags: review?(etienne)
Attachment #713907 - Flags: review?
Attached patch Patch v2Splinter Review
Less forgotten things.
Attachment #713907 - Attachment is obsolete: true
Attachment #713907 - Flags: review?(etienne)
Attachment #713940 - Flags: review?(etienne)
Comment on attachment 713940 [details] [diff] [review] Patch v2 Review of attachment 713940 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the changes to the fm app removed (since they break the app ;) )
Attachment #713940 - Flags: review?(etienne) → review+
What's the expected perf win for this? Which apps should be improved?
(In reply to Chris Jones [:cjones] [:warhammer] from comment #7) > What's the expected perf win for this? Which apps should be improved? The win depends on the app. If you look at datazilla you will see an improvement for gallery/music/sms between https://github.com/mozilla-b2g/gaia/commit/2e4d862b5592e1a3 and https://github.com/mozilla-b2g/gaia/commit/a09de87ea2be9cc0 which I would associate to this PR. The theory I have is that instead of blocking on the main thread for reading scripts and then parse the html, the parser parse the html on it's own thread as soon as possible and scripts are parsed on the main thread in parralel.
Attached patch FollowupSplinter Review
I add an additional space somewhere and the browser is broken in production mode now :(
Attachment #714333 - Flags: review?(etienne)
Attachment #714333 - Flags: review?(etienne) → review+
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #10) > https://github.com/mozilla-b2g/gaia/commit/ > 83ea6d7a59071369376be9ef9b4b397a378dc18a Not blocking, but we will approve this change for v1-train and v1.0.1.
blocking-b2g: tef? → -
tracking-b2g18: --- → +
Attachment #713940 - Flags: approval-mozilla-b2g18+
Attachment #714333 - Flags: approval-mozilla-b2g18+
Henri wrote the HTML 5 parser, so I'm wondering if comment 8 sound right to him...
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #8) > The theory I have is that instead of blocking on the > main thread for reading scripts and then parse the html, the parser parse > the html on it's own thread as soon as possible and scripts are parsed on > the main thread in parralel. The parser thread keeps parsing on its own thread in any case. Normal <script> doesn't block the parser thread. It blocks DOM construction on the main thread. Meanwhile, the parser thread keeps parsing and generating a sequence of operations that need to be performed for DOM construction later. The sequence of operations can be used unless the script does an unbalanced document.write() (unbalanced meaning that it opens a different number of elements than it closes). Defer runs scripts after DOM construction. The JS source is parsed at that point, so there isn't HTML parsing and JS parsing parallelism is the defer case. The main benefit compared to putting a normal <script> at the bottom of the HTML source is that the network fetch can start sooner. Note that there's also the option to run scripts as soon as they are available, but that's the async attribute rather than the defer attribute.
Ask john for for uplift
Flags: needinfo?(jhford)
Marking tef+ since that is what's needed at this stage to get uplift to v1-train *and* v1.0.1
blocking-b2g: - → tef+
Commit 83ea6d7a59071369376be9ef9b4b397a378dc18a does not apply to v1-train or v1.0.1. This means that there are merge conflicts which need to be resolved. If there are dependencies that are not approved for branch landing, or have yet to land on master, please let me know If a manual merge is required, a good place to start might be: cd gaia git checkout v1-train git cherry-pick -x -m1 83ea6d7a59071369376be9ef9b4b397a378dc18a <RESOLVE MERGE CONFLICTS> git checkout v1.0.1 git cherry-pick -x $(git log -n1 v1-train)
Flags: needinfo?(jhford)
Bug 837267 is producing this conflict. While it should be easy to merge, I'd rather uplift that low-risk bug too and I accordingly asked an approval there.
If Bug 837267 is not approved on v1.0.1 then we could easily resolve the conflict.
(In reply to Julien Wajsberg [:julienw] from comment #18) > If Bug 837267 is not approved on v1.0.1 then we could easily resolve the > conflict. Okay, please do this as uplifting bug 837267 was deemed unnecessary risk during the triage meeting today (the day of 1.0.1 handoff).
see https://github.com/julienw/gaia/tree/841353-resolve-conflict for v1.0.1 for v1-train I believe bug 837267 will ultimately land so we can wait for that.
v1.0.1: bc34b39420a3d16b50fe70ed4d3641dc6ebfea09
Per comment 20, which refers to something which did land on v1-train, setting status-b2g18 to wontfix
Sorry if that wasn't clear. I wanted to mean that when Bug 837267 will be landed to v1-train, this one could land to v1-train without conflict. I think this happened now so you can proceed, thanks a lot John !
Still having a merge conflict on v1-train with: git checkout v1-train git cherry-pick -x -m1 83ea6d7a59071369376be9ef9b4b397a378dc18a # both modified: apps/browser/index.html <!-- Shared code --> ++<<<<<<< HEAD + <script type="application/javascript" src="shared/js/l10n.js"></script> + <script type="application/javascript" defer src="shared/js/gesture_detector.js"></script> ++======= + <script defer src="shared/js/l10n.js"></script> + <script defer src="shared/js/gesture_detector.js"></script> + + <!-- Specific code --> + <script defer src="js/places.js"></script> + <script defer src="js/date_helper.js"></script> + <script defer src="js/modal_dialog.js"></script> + <script defer src="js/authentication_dialog.js"></script> + <script defer src="js/browser.js"></script> + <script defer src="js/browser_extensions.js"></script> ++>>>>>>> 83ea6d7... Merge pull request #8132 from vingtetun/841353-followup <!-- Resources -->
Flags: needinfo?(felash)
(In reply to Julien Wajsberg [:julienw] from comment #25) > John, there are 2 commits here : > > https://github.com/mozilla-b2g/gaia/commit/ > 88568d9f69edf0fcb7c59613f961b8804f1eaa88 > https://github.com/mozilla-b2g/gaia/commit/ > 83ea6d7a59071369376be9ef9b4b397a378dc18a > > I think you only tried to cherry-pick the second one. you are correct, I did only try the second one.
Squashed the commits: v1-train: a3e3407f867980178a31262a6893fbf2ee22f636
Just saw that I messed up in comment 20 : I only used the second commit. Just tried to cherry pick the first commit too (88568d9f69edf0fcb7c59613f961b8804f1eaa88) and there are conflicts. I try to sort this out.
v1.0.1: c342bb232e46bb88714ead96e2401f5815f3ea67 sorry for the mess.
does not make sense to create a regression issue.
Flags: in-moztrap-
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
Nothing much to verify, except that the various affected apps still work. Maybe check that they load in less than 1 sec. Affected apps are : browser calendar camera clock communications (dialer, contacts, ftu, facebook import) fm gallery music sms video
Whiteboard: [FFOS_perf] → [FFOS_perf] QARegressExclude
Whiteboard: [FFOS_perf] QARegressExclude → [FFOS_perf] QARegressExclude, [qa-]
Assignee: 21 → nobody
Keywords: verifyme
QA Contact: jhammink
Whiteboard: [FFOS_perf] QARegressExclude, [qa-] → [FFOS_perf] QARegressExclude
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: