How to optimize Dojo load times?

I am working on a business application based on PHP and Dojo toolbox. The interface is similar to what you see in the Dojo dijit theme tester.

It takes a long time on the internet to load all these js one by one.

I want to know what is the best method used by the tester demo test, that it loads much faster than the one we built.

I am curious about how best to optimize load times?

+3


source to share


1 answer


You rightly pointed out that the biggest cause of a runtime performance problem is a lot of server calls to get small JS files. While Dojo's modular design is very useful at design time (widget extensions, namespace, etc.), at runtime, you are expected to optimize a bit of Dojo - the way to do it to make a custom build.

Doing a custom build will give you a big performance boost: hundreds of rounds will be reduced to one or two, and the payload size will also decrease dramatically. We saw a 50x performance improvement with a custom build

The custom assembly will create an optimized, compressed JS file that only contains the code you use in your application. You can define multiple levels depending on how you want to split your application JS files (for example one compressed file and multiple files included in different UIs) depending on the version of Dojo you are using, see:



http://dojotoolkit.org/reference-guide/1.7/build/index.html#build-index http://dojotoolkit.org/reference-guide/1.7/build/pre17/build.html#build-pre17-build

While it looks intimidating at first, sit with it and you can build an optimized version and see the benefits :)

+12


source







All Articles