Optimising your Dojo application using the Dojo build system
Why should you use the Dojo build system? Find out why your users care and how to dramatically improve the performance of your web application. Introduction to the 1.6 build system along with the upgrade path for the new 1.7 build system.
How do I use the Dojo build system? – Creating a sample application build in 1.6 – Migrating a sample build to 1.7 What are the best practices for the build system? Thursday, 3 May 2012
seconds slower resulted in a 4.3% drop in revenue/user” Google - “A 400 millisecond delay caused a 0.59% drop in searches/user” Yahoo! - “A 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic” Shopzilla - “Speeding up their site by 5 seconds increased their conversion rate 7-12%” Mozilla - “Shaving 2.2 seconds off their landing pages increased download conversions by 15.4%” Source: http://www.stevesouders.com/blog/2010/05/07/wpo-web-performance-optimization/ Thursday, 3 May 2012
Combine multiple JavaScript modules and dependencies into a single file Inline widget templates & i18n dependencies into the module definition “Minify” source files using JavaScript optimiser (strip comments, rename variables, remove whitespace...) Inline all imported CSS files into parent source Thursday, 3 May 2012
Combine multiple JavaScript modules and dependencies into a single file Inline widget templates & i18n dependencies into the module definition “Minify” source files using JavaScript optimiser (strip comments, rename variables, remove whitespace...) Inline all imported CSS files into parent source ...massively improve the performance of my application! Thursday, 3 May 2012
Define your application’s build profile Run the build scripts to generate the layers Use the resulting layer files in your application Thursday, 3 May 2012
Define your application’s build profile* Run the build scripts to generate the layers Use the resulting layer files in your application* ... regardless of version (although there are differences between 1.6 or lower and 1.7+) Thursday, 3 May 2012
file contains the following.... JavaScript source setting up “dependencies” object with build profile. Usually contains the following properties.... – “layers” – “prefixes” – optimisation parameters for JS and CSS Numerous examples build profiles under “dojo-source- directory/util/buildscripts/profiles” Thursday, 3 May 2012
following command (Linux) $ sh build.sh action=release profile=my_app Run the following command (Windows) $ build.bat action=release profile=my_app Thursday, 3 May 2012
following command (Linux) $ sh build.sh action=release profile=my_app Run the following command (Windows) $ build.bat action=release profile=my_app Mapped to “./profiles/my_app.profile.js” Thursday, 3 May 2012
build.sh action=release profile=my_app release: Using profile: profiles/my_app.profile.js release: Using version number: 0.0.0.dev for the release. release: Copying: ../../dojo/../dijit to: ../../ release/dojo/dijit release: Copying: ../../dojo/../../my_company to: ../../release/dojo/my_company release: Copying: ../../dojo to: ../../release/ dojo/dojo release: Building dojo.js and layer files release: Optimizing (shrinksafe) file: ../../ release/dojo/dojo/dojo.js release: Files baked into this build: dojo.js: Build time: 16.004 seconds Thursday, 3 May 2012
three main steps... Define your application’s build profile Run the build scripts to generate the layers Use the resulting layer files in your application Thursday, 3 May 2012
three main steps... Define your application’s build profile – Add package descriptor – Convert build profile Run the build scripts to generate the layers Use the resulting layer files in your application Thursday, 3 May 2012
three main steps... Define your application’s build profile Run the build scripts to generate the layers – Use package build profile Use the resulting layer files in your application Thursday, 3 May 2012
following command (Linux) $ sh build.sh action=release profile=../../../ my_company/my_app.profile.js Run the following command (Windows) $ build.bat action=release profile=../../../ my_company/my_app.profile.js Thursday, 3 May 2012
three main steps... Define your application’s build profile Run the build scripts to generate the layers Use the resulting layer files in your application – Must use AMD loader rather than <script> tags Thursday, 3 May 2012
layer... Hugely inflated download size on first page visit Each pages requires parsing unneeded modules When a single module changes, user has to download entire layer again Thursday, 3 May 2012
layer... Hugely inflated download size on first page visit Each pages requires parsing unneeded modules When a single module changes, user has to download entire layer again ... so what should we do? Thursday, 3 May 2012
How do I use the Dojo build system? – Creating a sample application build in 1.6 – Migrating a sample build to 1.7 What are the best practices for the build system? Thursday, 3 May 2012
Impact session and speaker feedback! Your feedback is very important to us, we use it to improve our conference for you next year. Go to impactsmartsite.com from your mobile device From the Impact 2012 Online Conference Guide: – Select Agenda – Navigate to the session you want to give feedback on – Select the session or speaker feedback links – Submit your feedback Thursday, 3 May 2012
logo, ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/ copytrade.shtml. Copyright and Trademarks Thursday, 3 May 2012