Login Register

Show me a websites that heavily uses dojo and doesn't take forever to load

Can someone show me a site that heavily uses Dojo and does not take forever to load. Mine does. I want to create a custom build... I posted about it before, no help @ all. I've been in the "Dojo Showcase" forum and am not impressed thus far that there is a site that heavily uses Dojo and works nicely and loads quickly.

hmm

mapquest.com? beta.bloglines.com? AOL WebMail?

Sorry your build question went unanswered -- The build master guy is generally on top of all things dojo build in the forums. Perhaps it didn't provide enough information to really help you? Could you post the link in this thread to that one?

I don't think those are

I don't think those are heavy use @ all (I could be so wrong). Have a look here http://208.138.22.177/mgitracking
User: jay
Psw: jayjay
If you load that website... It takes a minute or longer depending somewhat on your connection speed and FREEZES up the browser in the mean time. So i'm kinda cornered in a way. I need to optimize this, I want to try doing a custom build of Dojo, however... I can't get a proper svn url, none of the ones I've seen so far work. So I can't get on to that.
My hands are tied, coz am not sure what to do??? I don't know how I would interrupt that process and put a startup message or something like that so the user experience is not as terribly slow as it currently is.

I use all of the following requires... and I'm thinking I probably got ahead of myself and I should NOT be using so many dojo widgets on one page. So I'm seriously looking to quell that possibly marred impression that I have. I'm essentially trying to build an entire "desktop looking app" with Dojo but I'm thinking I'm using the wrong tool because of the serious speed bumps.

dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.CheckBox");
dojo.require("dijit.Menu");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.LayoutContainer");
dojo.require("dijit.layout.SplitContainer");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.Dialog");
dojo.require("dijit.ColorPalette");
dojo.require("dijit.form.DateTextBox");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.ProgressBar");

Not knowing your app at all...

...I would hazard a guess that you're also probably attempting to load content via a ContentPane while the document actually loads as well; this can be a common error to make, because you might think that you're lazy-loading things when in reality you're actually causing more requests to be made over the wire--and probably pushing up against that 2 connection limit most browsers have.

Its more than possible to write Dijit-based apps with a *lot* of widgets on a page and not have the browser load very slowly (dante mentioned a few public ones, there's a number of private ones as well), so I would be thinking that you're running across architectural issues as opposed to Dijit ones (Dijit can be very easy to abuse ;).
---

Probably you should be posting this thread in the Dijit support forum as well; dante's really good about looking over the entire forum set but probably you'll get better, more accurate help if you start a similar perf thread in Dijit support.

And after looking at the example link you posted...

...I think you have some major server optimization you need to do; even though I did see what you were talking about with dojo freezing up the app, by far the sheer amount of tiling you're using is taking a long time, particularly when each image request is being served by php and not directly from a filesystem.

Loading the app in Safari and watching the network progress showed a small loading gap between LayoutContainer and SplitContainer; that might have just been bad timing on my part but I think your first step would definitely be to do a build and see what happens then.

I also think you would be better served by removing the other 3 JS libraries you're using and simply use the Dojo equivilents; not sure about your ajax one but the Walter Zorn library is pretty old and can step on a lot of other JS toes, so to speak.

Forgive me... I'm having a

Forgive me... I'm having a bit of difficulty with understanding some of the things you're saying. What 3 javascript libraries are you talking? I use quite a few.

<script type="text/javascript" src="DHTMLapi.js"></script>
      <script type="text/javascript" src="xhr.js"></script>
      <script type="text/javascript" src="kaMap.js"></script>
      <script type="text/javascript" src="kaTool.js"></script>
      <script type="text/javascript" src="kaZoomer.js"></script>
      <script type="text/javascript" src="kaQuery.js"></script>
      <script type="text/javascript" src="tools/rubberzoom/kaRubberZoom.js"></script>
        <script type="text/javascript" src="wz_dragdrop.js"></script>
        <script type="text/javascript" src="kaZoomer.js"></script>
        <script type="text/javascript" src="xhr.js"></script>
        <script type="text/javascript" src="excanvas.js"></script>
        <script type="text/javascript" src="wz_jsgraphics.js"></script>
        <script type="text/javascript" src="XMLOverlay/kaXmlOverlay.js"></script>
        <script type="text/javascript" src="tools/tooltip/kaToolTip.js"></script>

Then further down ....

<script src="jsutil.js"></script>
      <script src="maputil.js"></script>
      <script src="BubbleTooltips.js"></script>

Nothing's wrong with the Walter Zorn Library @ all... it can be seen used with Kamap main application (which I'm building untop of)... http://208.138.22.177/kamap/

maputil.js however is MY main script where I add on to that framework and heavily use Dojo, creating Widgets on the fly and so on.

Secondly, unless you're saying that the combination of the tile.php fetching the different tiles (images) for the map combined with Dojo is a bad idea. Which really shouldn't be the case since the map only starts loading AFTER dojo loads up. However, there's nothing wrong with the mapping side of things. You can see a plain example of just the map working if you look at the url I put earlier in the post. When I look at Firebug, the tile.php calls start further down... they took up about 40s and while it's loading it does not hang up the user display, so it really can't be blamed.

I'm giving the custom build a shot for now... but I can't convince myself to use anymore Dojo until I can optimize what currently exists now.

I'm referring to...

...DHTMLapi.js, excanvas.js and the wz_ libraries...plus the xhr.js. IIRC all of these facilities are provided by Dojo, and there have been posts on these forums indicating some problems trying to mix the two (the Walter Zorn libraries in particular off the top of my head); so what I was suggesting is that you might want to take a look at some of what Dojo provides with the aim of replacing/removing the other libraries, and therefore get a little more optimization out of what you're doing.

I'm not referring to the Kamap application at all; that's highly specialized, and while I'll admit I don't know it all I'd say that based on what you're doing, that's probably not replaceable. If Kamap itself requires the other libraries, then I don't see that you have a choice to use them.

WRT to the tile.php commentary...I'm not suggesting at all that the combination of that and Dojo is a bad thing; I'm just pointing out that once you get past the point of Dojo/Dijit instantiation, your tile.php requests are also taking a long time to load and might be something you also want to look at for performance optimization.

---

The main point of what I was trying to convey is that in general, when you are seeing performance issues like this with Dijit, there are usually two main causes:

1. Not using a custom build
2. Using Dijit in such a way as to try to front-load absolutely everything at once (i.e. architecture).

Builds help an awful lot but they are not a panacea; its not going to magically make all your performance issues go away--especially if you're using widgets in a way that kind of force everything to try to do all the needed operations at once. Good app planning is still essential, especially when you're talking about an application that is similar to the way Google or Yahoo Maps work.

The other comments I made simply point at other possible areas for performance optimization that have nothing really to do with the Dojo Toolkit; these are issues with which we (the authors of the library) wrestle with all the time.

Alright... crystal... Got

Alright... crystal... Got you.
Thanks you guys for your help thus far. Really appreciate the quality of the responses.

Now I'm noticing there are alot things I'm NOT doing properly and need to learn about the proper way to do them. I saw the comment about "easy to misuse Dijit" and I'm concerned about that... What is the proper way to go about loading the different widgets on to the page.

I've pasted the contents of the main.php file here http://pastebin.com/m1c41e427
The empty two posts before this one was me trying to paste the contents here... that didn't work.

If anyone could take a look at it. Tell me if it demonstrates misuse of the components. If there is any reading/links you could point me to to get better tips about how to use Dijit properly, that is also greatly appreciated.

Took a quick look...

...not seeing anything obvious. Did you get the build going yet? That might help a bit more than you'd think...often times doing one require() triggers a lot of other requires, and that's what the build system tries to address. From what I see, your use of Dijit is pretty basic; there may be some layout issues but that would happen after the rest of the code is loaded, not during (unless you try to resize the browser during load)...

The situation gets worse

The situation gets worse when I actually upload that copy to the real server. That's my local copy. Dojo takes 1.35m according to FireBug to load out of the 1.83m the entire site takes the load. It takes the rest of the page only 40 s to load.

So in other words... plz HELP!!!!!!!!!!!!!!!!!!!!!!

I'd say you are in fact

I'd say you are in fact wrong. :)

They are incredibly heavy uses of Dojo + heavy use of custom dojo-based widgets and code.

So I've made up a screencast (sans audio, sorry) optimizing your dijit require()'s ... Those listed on a blank page total about 730k uncompressed. After passing it through a build it's about 250k. It's a simple example, but shows all the steps from svn co to updating your file for a build. You can also see a significant reduction in the number of requests being sent on the wire, which speeds it up even more.

The video is about 12 minutes, most of which is me waiting on dojox/ and util/ repo's to download :) The video is pretty large (~30meg, so may disappear after a few viewings, I suggest you save it if you want it), but should be enough to get you going. only in QuickTime .mov format:

http://dante.dojotoolkit.org/video/build.mov

Not much can be done about page-load parsing unless you want to implement some kind of preloader overlay like themeTester does, or a more advanced one like my logo animation:

http://www.sitepen.com/labs/code/fx/logo-xd.html

But parsing is expensive, and could lock up a browser, yes. I suggest you defer it until you have to run it, and turn parseOnLoad:false on ... or parse parts of it in increments while the use is logging in? There are many techniques.

Also note, the sizes above are NOT gzip sizes (my local server isn't setup to gzip/deflate) ... gziping mine/layer.js makes it: 58k -- slightly larger than your logo image I bet ;)

Note, you shouldn't manually gzip the file, but rather let your webserver do it on the fly. This is just here to show file sizes:

-rw-r--r--    1 dante  dante   58196 Apr 11 09:29 layer.js.gz
-rw-r--r--    1 dante  dante  469206 Apr 11 09:29 layer.js.uncompressed.js

Hope this helps.

Hi, your video was very

Hi, your video was very helpful. Really appreciate that you did that up on the fly. However.. I just have one piece left. I did the new release... and I have my release folder intact. A few confirmations and a few questions.

Confirmations
1. I need to point to the dojo.js in my release/dojo/dojo folder.

Questions
1. Do I leave all the require statements in place?
2. I never used layer.js before... Do I need to include that and where should I include that?

In essence, how should the following segment be changed to utilize the built components?

<script src="cbuild/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
 <script type="text/javascript">
      dojo.require("dojo.parser");
      dojo.require("dijit.form.Button");
      dojo.require("dijit.form.FilteringSelect");
      dojo.require("dijit.form.TextBox");
      dojo.require("dijit.form.CheckBox");
      dojo.require("dijit.Menu");
      dojo.require("dijit.layout.AccordionContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("dijit.layout.LayoutContainer");
      dojo.require("dijit.layout.SplitContainer");
      dojo.require("dijit.layout.TabContainer");
      dojo.require("dijit.Dialog");
      dojo.require("dijit.ColorPalette");
      dojo.require("dijit.form.DateTextBox");
      dojo.require("dojo.data.ItemFileReadStore");
      dojo.require("dijit.ProgressBar");
 </script>

I have changed it and so far I have not seen a change in the file size. So I anticipate that I am not doing something correctly.
My build file...

dependencies = {
        layers: [
                {
                        //For 0.9 you normally do not specify a dojo.js layer.
                        //Note that you do not need to specify dojo.js as a dependency for
                        //other layers -- it is always an implicit dependency.
                        name: "dojo.js",
                        dependencies: [
                                "dojo.parser"
                        ]
                },
                {
                        //This layer will be discarded, it is just used
                        //to specify some modules that should not be included
                        //in a later layer, but something that should not be
                        //saved as an actual layer output. The important property
                        //is the "discard" property. If set to true, then the layer
                        //will not be a saved layer in the release directory.
                        name: "string.discard",
                        resourceName: "string.discard",
                        discard: true,
                        //Path to the copyright file must be relative to
                        //the util/buildscripts directory, or an absolute path.
                        copyrightFile: "myCopyright.txt",
                        dependencies: [
                                "dojo.string"
                        ]
                },
                {
                        name: "../mine/layer.js",
                        resourceName: "mine.layer",
                        dependencies: [
                                "mine.layer"
                        ]
                }
        ],

        prefixes: [
                [ "dijit", "../dijit" ],
                [ "dojox", "../dojox" ],
                [ "mine",  "../mine" ]
        ]
}

//If you choose to optimize the JS files in a prefix directory (via the optimize= build parameter),
//you can choose to have a custom copyright text prepended to the optimized file. To do this, specify
//the path to a file tha contains the copyright info as the third array item in the prefixes array. For
//instance:
//      prefixes: [
//              [ "mycompany", "/path/to/mycompany", "/path/to/mycompany/copyright.txt"]
//      ]
//

you would simply need to

you would simply need to include the layer file in your page in place of the dojo.require()'s. They are safe to leave, if the resource is ready dojo.require() does nothing. you can dojo.require("mine.layer"); and the code will be loaded, or you can add a script tag like the example pointing to your layer file.

yes you will need to adjust the paths from you development code to point to the optimized dojo.js and layer.js, both now found in release/dojo/ folders.

<script src="cbuild/dojo/release/dojo/dojo/dojo.js" djConfig="parseOnLoad:true"></script>

<script src="cbuild/dojo/release/dojo/mine/layer.js"></script>
<!-- or -->
<script type="text/javascript">
  dojo.requre("mine.layer");
</script>

the layer file is just a bunch of requires(). it gets replaced with the actual code and dependencies, so adjusting the path is like a magic speed boost.

dante, you suggested a

dante, you suggested a highly interesting option:

"or parse parts of it in increments while the user is logging in?"

are there any example online which illustrate that technique ? And how do you recommend to split the source markup so that different parts get parsed at different times ? Do you mean e.g. parsing one part while user is expected to provide his credentials and parsing the other part after user has pressed submit ?

regards
Roberto
--
http://rsaccon.com

dante, you suggested a

dante, you suggested a highly interesting option:

"or parse parts of it in increments while the user is logging in?"

are there any example online which illustrate that technique ? And how do you recommend to split the source markup so that different parts get parsed at different times ? Do you mean e.g. parsing one part while user is expected to provide his credentials and parsing the other part after user has pressed submit ?

regards
Roberto
--
http://rsaccon.com

no, no live examples

But i've used the technique in client applications. The theory is simple, but could get horribly complex in practice.

I've just had a neat idea on how I could use the themeTester as an example. When time permits, I will make it available. The jist is: break each of the parts of the themeTester into bite-size pieces, and parse one piece at a time, stalling momentarily in between giving the browser time to catch up.

To increase INITIAL load time, we can manually load in the HTML segments when needed, and parse them as they come in. When you have large large pages, all you really need to load initially is the css, dojo.js + layer.

dante, thanks, now I hope

dante, thanks, now I hope you find that time and I look forward to see it in the themeTester

Roberto