[thelist] using includes and performance issues

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Thu Feb 13 11:02:01 CST 2003

>I'd say the average page has 10 includes. Some have less, some more
>detailed pages have more.
>Does this affect performance issues? If so how? I understand their
>desire to keep a design standard and using includes is one way, and
>the pages are all slightly different.


I can only speak for ASP since I don't know JSP at all. In a nutshell, yes
it does impact performance.

The ASP request process works like this:

  1. User requests page from IIS
  2. IIS parses request
  3. If .asp file was requested, IIS passes execution to ASP engine
    a. ASP engine loads requested .asp file
    b. ASP engine parses .asp file for includes. At each include statement,
it fetches the included file and places the contents in the place of the
include directive.
    c. ASP engine then checks to see which script language is being used on
the page. If none specified, uses the default specified in IIS. Once
determined, the ASP engine then passes control to the appropriate script
engine (VBScript, Jscript, etc).
    d. Script engine parses the file built by the ASP engine and
compiles/executes the script
    e. Script engine returns results to ASP engine
    f. ASP engine returns results to IIS
  4. IIS returns results to the user

There may be some slight discrepancies between step d and e, I'm not an
uber-com gearhead but AFAIK this is how it works.

As you can see from step b and d, each ASP file is parsed twice, once for
includes and another for the actual script. When the ASP engine encounters
an include directive, it replaces the include directive with the contents of
the referenced file. Then the script engine executes the resulting script.

This is where the namespace collision issue comes in, because the script
engine only sees one long script, not a series of includes.

Also, includes can be nested, so the ASP engine will crawl the length and
breadth of your include tree putting files into the final script to be
passed to the script engine for execution.


More information about the thelist mailing list