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.
Contents
Installation
Python 2.5.4
Run the install and take the default install options.WWHelp Optimizer (2009-03-23)
Unzip into a convenient location.
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 |
Austin, TX |
146 requests - 3.87 seconds |
97 requests - 2.54 seconds |
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:
python wwhelp5.optimizer.py <path_to_wwhelp>
Assuming Python 2.5 is installed, the full command becomes:
C:\Python25\python.exe wwhelp5.optimizer.py <path_to_wwhelp>
Running the Python Script (Command Line)
For those who are unused to running command line scripts, here's how it is done:
Open a Command Prompt window (Start > Programs > Accessories > Command Prompt).
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).
- Drag python.exe from Explorer to the Command Prompt window. The complete path appears in the window. Add a space at the end.
- Drag wwhelp.optimizer.py to the Command Prompt -- and add a space after.
Drag WebWorks Help 5.0 to the Command Prompt.
- Press Enter -- the screen should return to the original prompt after a slight pause.
- 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.
Start PythonWin.
Open the "wwhelp5.optimizer.py" script (File -> Open)
Run the script (File -> Run, or Ctrl+R)
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:
- Open Optimize.py in a plain text editor.
- Locate the following line (probably line 419):
DeleteFile(os.path.join(VarWWHDataDirectoryPath, 'xml', 'files.xml'))
- 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
2009-03-23 wwhelp5.optimizer.2009-03-23.zip (tested against 9.3, 2008.3, and 2008.4 output)
2009-01-23 wwhelp5.optimizer.2009-01-23.zip (breaks on output prior to 2008.4 per MaryAnthony and wwp-users)
2008-12-15 wwhelp5.optimizer.2008-12-15.zip
2008-12-11 wwhelp5.optimizer.2008-12-11.zip
2006, Fall wwhelp5.optimizer.zip
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:
wwhelp wwhimpl common scripts *.js js scripts *.js
becomes:
wwhelp wwhimpl common scripts.js js scripts.js
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:
documt1s.js outlin1s.js search1s.js
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:
-maxjssearchsize 0
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:
<IfModule mod_expires.c> ExpiresByType application/x-javascript A3600 ExpiresByType image/x-icon A3600 ExpiresByType text/css A3600 ExpiresByType text/plain A3600 </IfModule>
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.