WebWorks Help Optimizer

Status

2009-03-23

Changes in 2009-01-23 to support Unicode word breaker cause the optimizer to work only for 2008.4 output, not prior versions.

2009-01-23

2008.4 - Support for new Unicode word breaker scripts

2008-12-15

Bug fix based on customer feedback

2008-12-11

2008.3 - Fix for paths with spaces and special characters

2008-09-19

9.3 tests

2008-05-12

Initial version.

Description

The goal of this project is to speed load times for WebWorks Help deliverables.

Installation

Benchmark Info

Benchmarks gathered in 2006 demonstrate that performance is limited by the number of file requests made to load WWHelp 5.0. The size of the files themselves seems to have little impact on start-up performance.

Tools:

Test sites:

Results:

Who

Where

Unoptimized

Optimized

BenAllums

Austin, TX

146 requests - 3.87 seconds

97 requests - 2.54 seconds

More Examples

Optimizer in Python

An early attempt at optimizing WWHelp 5.0 with a Python script was made in 2006. The results were useful for testing purposes, but were not ready for production deployment.

Run with:

Assuming Python 2.5 is installed, the full command becomes:

Running the Python Script (Command Line)

For those who are unused to running command line scripts, here's how it is done:

  1. Open a Command Prompt window (Start > Programs > Accessories > Command Prompt).

  2. Open three Windows Explorer windows:

    • Point the first Explorer at python.exe (e.g., C:\Python26\python.exe).
    • Point the second at your unzipped wwhelp.optimizer.py (e.g., C:\Documents and Settings\user.name\Desktop\wwhelp5.optmizer.2008-12-15\wwhelp.optimizer.py).
    • Point the third at your Output\WebWorks Help 5.0 folder (e.g., C:\AA_Work\Viztopia\UserGuide\AF_VPM_JM\Webworks\AF_VPM_JM\Output\WebWorks Help 5.0).

  3. Drag python.exe from Explorer to the Command Prompt window. The complete path appears in the window. Add a space at the end.
  4. Drag wwhelp.optimizer.py to the Command Prompt -- and add a space after.
  5. Drag WebWorks Help 5.0 to the Command Prompt.

  6. Press Enter -- the screen should return to the original prompt after a slight pause.
  7. Check for the changes.

Running the Python Script (with PythonWin)

And for those that dread the Windows command prompt; you can also use a GUI like the free PythonWin for running the Optimizer. Download the version of PythonWin that fits your Python interpreter version here: http://sourceforge.net/project/platformdownload.php?group_id=78018&sel_platform=3212.

  1. Start PythonWin.

  2. Open the "wwhelp5.optimizer.py" script (File -> Open)

  3. Run the script (File -> Run, or Ctrl+R)

  4. Enter the quoted(!) path to your "WebWorks Help 5.0" folder in the Arguments field and click OK.

Script variations

Retaining files.xml

If your developers use Files.xml for finding your context-sensitive links, you need to adapt Optimize.py (not wwhelp5.optimize.py, which calls Optimize.py).

If you don't change Optimize.py, there will definitely be tears before bedtime -- your F1 Help will stop working. Thanks to Ben A for the hint.

To retain Files.xml:

  1. Open Optimize.py in a plain text editor.
  2. Locate the following line (probably line 419):
    DeleteFile(os.path.join(VarWWHDataDirectoryPath, 'xml', 'files.xml'))
  3. Replace that line with the following lines (which include a comment):
    # Do not delete the following line if using Files.xml  for context-sensitive links -- [add your Name and Date here]
    # DeleteFile(os.path.join(VarWWHDataDirectoryPath, 'xml', 'files.xml'))
    #

Releases

Scripts have been tested with Python 2.3 and 2.5. Python 2.2.3 and 2.6 are reported to work as well.

Design Notes

Basically, what you do is collapse all .js files into a single file. Doing this for the help runtime is pretty easy.

This:

becomes:

Of course, this means you have to search/replace all references to "scripts/*.js" with "scripts.js".

The exception to this "collapse" rule involves any .js files with numbers in their name:

These files are used to load your help set information.

The tricky part is optimizing the help set information load. That part is where you get your biggest "win", but it is also tricky to do. I can't recall off the top of my head quite how to do it.

One thing you can do is override the "wwhelp_index.xsl" file to reduce the number of search files generated by "wwhelp5.exe". If you pass the option:

then "wwhelp5.exe" will generate a single "search0.js" data file instead of multiple ones. This will greatly speed up your search (but break searching on Win98, IE 5/6 systems).

Server Configuration

For our own servers, we're seeing excessive JavaScript and CSS requests. Turns out, we were missing proper expiration dates for our .js and .css files. We have now added the following to our Apache website configurations:

Previously, our server reported 60 second expiration times. Now we report 1 hour (3600 second) expiration times.

A misconfiguration of your web server may cause excessive network activity when accessing WWHelp 5.0 help sets.

DevCenter/Projects/WebWorksHelp/Optimizer (last edited 2010-03-31 23:08:12 by BenAllums)