• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Efficiently downloading and executing Javascript
 

Efficiently downloading and executing Javascript

on

  • 891 views

 

Statistics

Views

Total Views
891
Views on SlideShare
882
Embed Views
9

Actions

Likes
2
Downloads
9
Comments
0

1 Embed 9

http://www.linkedin.com 9

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Efficiently downloading and executing Javascript Efficiently downloading and executing Javascript Presentation Transcript

    • Efficiently downloading and executing Javascript Pablo Moretti MercadoLibre
    • Agenda● Script tag● Script injection (async)● Script injection with callback● Download and execution in order Lets go …
    • Example Page Javascript resources ● Jquery, Chico & 3 dummy resources ✕ Blocked DOM ✕ Load time ✔ Parallel requests * ✔ Share resources
    • Script tagFirst approach,join all javascripts. ✕ Blocked DOM ✕ Parallel requests * ✕ Load time ✕ Share resources ✔ Less requests * 90% of the browsers that navigate ML support 6 or more concurrent connections per domain.
    • Script tagA better idea is to joinonly the dummies jsand put the script inthe bottom. ✕ Blocked DOM ✔ Share resource ✔ Less requests ✔ Parallel requests ✔ Load time
    • Script injection (async)This is the injection ofscript from another script. ✕ Blocked onload ✕ Parallel requests ✕ Share resources ✔ No blocked DOM ✔ Load time ✔ Less requests
    • Script injection with callbackWe could use a library and ✔ No blocked onloadtrigger it in onload event. ✔ Share resources ✔ Less requests ✕ Parallel requests ✕ Load time
    • Download and execution in orderWe could use a better library ✔ No blocked onload ✔ Parallel requestsand trigger it in onload event. ✔ Load time ✔ Less requests ✔ Share resources
    • Defer & queue javascript inline Using a similar technique of GA track, we can defer the execution of javascipt inline.The array is processed when wewant. For example, whenwe download the dependency.
    • Questions ?