Improve performance for Dojo-based Web 2.0 applications

Source: Internet
Author: User
Tags new features

One of the most focused aspects of Web 2.0 applications is the user experience, which users want to use as a fast and stable Web 2.0 application. The WEB 2.0 applications based on dojo often need to download a large number of dojo code to the client, and will occasionally launch an IO request from the back desk, the response speed is greatly affected. This article helps developers identify performance bottlenecks in WEB 2.0 applications by demonstrating practical techniques to improve Dojo performance.

WEB 2.0 and Dojo Introduction

WEB 2.0 applications with its rich user experience, fast response speed is more and more popular with many users. Classic apps like Google Map,flickr,yahoo Pipe take advantage of the WEB 2.0 feature. In some large commercial software, such as the new version of the IBM Portal, the new features of Web 2.0 are added.

From the perspective of implementation, the most distinctive feature of a WEB 2.0 application is the use of Ajax technology to carry out asynchronous data transmission, dynamically update the current page of a DOM node, the page part of the refresh, to avoid reloading the entire page, so that users can get faster response.

As one of the most widely used AJAX implementation frameworks, Dojo encapsulates an easy-to-use XMLHttpRequest to send requests to the background and respond to actions. What dojo makes most convenient for programmers is that it provides a lot of very useful widgets, based on the widgets provided by dojo, that programmers can create beautiful pages, including some animation effects, and so on.

While using Dojo to enjoy the convenience it brings, its performance problems are gradually exposed. For example, when a user loads a page for the first time, it downloads a large number of dojo files to the browser side, then executes the Dojo code, generates the corresponding page, and if you use the Dojo widget in your application, you must also download the corresponding HTML for the widget. template files and related other resources, is there any way to make it faster to download Dojo files? When a large number of dojo widgets are used on a page, the load of dojo becomes slower, so how do you make it faster?

Common techniques for solving Dojo performance problems

Customizing and compressing Dojo

Typically, a complete dojo library will be around 2M, which includes various JS tool methods provided by Dojo, core IO framework, Drag&drop support, rich widgets and their corresponding templates and CSS file images, and so on. In an application where the functionality provided by all of the dojo libraries is not usually used, we can tailor a personalized dojo by running a command in the Dojo release package.

Take Dojo1.0.2, for example, to download a full version of Dojo1.0.2 from Dojo's official website, util\buildscripts, profiles directory, and a number of *.profile.js files, which Dojo uses by default Base.pro File.js as a parameter to build, the contents of this file are as follows:

Listing 1. Base.profile.js

dependencies = {
  layers: [
    {
      name: "../dijit/dijit.js",
      resourceName: "dijit.dijit",
      dependencies: [
        "dijit.dijit"
      ]
    },
    {
      name: "../dijit/dijit-all.js",
      resourceName: "dijit.dijit-all",
      layerDependencies: [
        "../dijit/dijit.js"
      ],
      dependencies: [
        "dijit.dijit-all"
      ]
    },
    {
      name: "../dojox/off/offline.js",
      resourceName: "dojox.off.offline",
      layerDependencies: [
      ],
      dependencies: [
        "dojox.off.offline"
      ]
    }
  ],
  prefixes: [
    [ "dijit", "../dijit" ],
    [ "dojox", "../dojox" ]
  ]
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.