Chapter 10 Achieving Optimum Performance with PowerDynamo
DynaScript consists of several objects made up of methods and properties. In general, methods or properties that cause a connection to a database to be created or a document to be loaded are expensive to execute. When possible, you should avoid excessive use of the more expensive methods and properties in Web sites that hold performance at a premium.
For example, suppose you wanted to display the URL of the parent of your current document. Using the parent property is an expensive way of doing this.
<!--SCRIPT
document.WriteLn( document.parent.location );
-->
document.parent may require that the parent document be loaded from the database or file system. This may in turn, bump a document out of the document cache if the cache is full. A more resourceful way of obtaining the same information is to use document.location with the substring method to extract the parent's URL from the current URL. This is less expensive since the current document is already loaded.
<!--script
index=document.location.lastIndexOf("/");
document.writeln( document.location.substring( 0,index ) );
-->
The more expensive DynaScript methods and properties include:
Copyright © 1999 Sybase, Inc. All rights reserved. |