HTMLHelp: Activating gzip compression

This section is for programmers. Please use it for all discussons on interfacing help with your applications and related subjects.

Moderators: Alexander Halser, Michael Schwarzl

Post Reply
User avatar
Mike Linacre
Posts: 103
Joined: Wed Apr 06, 2005 11:12 pm
Location: Chicago
Contact:

HTMLHelp: Activating gzip compression

Unread post by Mike Linacre »

Friends, gzip-encoding speeds up webpage delivery for HTML files to modern browsers.

This can be activated in .htaccess and/or .httpd.conf of some servers (see Google)

For my Apache server, on which I have limited rights, but there is PHP for .php files:

a) change the published file-type suffix from .htm to .php in HM Configuration: HTMLHelp Export Options.
The starting webpage can stay as index.htm - it is small.

b) prepend the HTML Default Template with
<IF_HTML>
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
</IF_HTML>

c) if you are using active server-side file includes, change them (if necessary) from:
<!--#include virtual="filename" -->
to
<?php include "filename"; ?>
(pathnames may need adjusting)

Here is the report for a published Topic according to http://www.whatsmyip.org/http-compression-test/
Uncompressed Page Size: 154.5 KB
Compressed Page Size: 14.6 KB
Savings: 90.5%

Friends, suggestions for improvements are very welcome :-) or perhaps HM already does this :oops:
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: HTMLHelp: Activating gzip compression

Unread post by Tim Green »

Mike,

Just a terminology correction, which is very important: "HTML Help" is Microsoft CHM files, and only CHM files. The name Microsoft chose for their help format is unfortunately very confusing and it is very easy to make this mistake. It's a little bit like Java and JavaScript, which also have absolutely nothing to do with each other. It's important to always make a clear distinction between HTML Help ( = CHM, Windows only, local only, no support on servers, no server features) and WebHelp or normal HTML (normal browser, all server features supported). 8)

It's fine to enable compression like this on your server if you can. To be honest, however, the subjective improvements for the user are not nearly as large as often touted. They are real, but quite small in observable terms, and most people won't notice them at all. There are many other factors that are much more important for page delivery speed, all of which I am currently working on in the foundation technology for the next iteration of WebHelp due out around the end of the year.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Mike Linacre
Posts: 103
Joined: Wed Apr 06, 2005 11:12 pm
Location: Chicago
Contact:

Re: HTMLHelp: Activating gzip compression

Unread post by Mike Linacre »

Thanks, Tim. Apologies for the terminology errors :oops: , and delighted to hear that improvements are in the works :D

Tim, you are right. It is true that gzip, server-side-includes and other optimizations don't make much (if any) difference to most end-users, but I author for a niche market where that extra level of service (speed over slow connections, in this case) matters.
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: HTMLHelp: Activating gzip compression

Unread post by Tim Green »

Hi Mike,

I agree with you that every little bit helps. Google is doing more work on this than anyone else, and some of the most exciting recent developments are their increasingly sophisticated SPDY protocol family, which is achieving some quite stunning performance improvements. For WebHelp, the biggest factors will be the following:
  • Load all JavaScript after the actual page has loaded.
  • Only load absolutely essential CSS before loading the page.
  • Serialize all essential JavaScript into a single file.
  • Load scripts for additional functions only when needed. Unload them if they are not used again.
  • Only load the main structure of the layout once. Content like new topics gets loaded into the main page, loading only the content and no repeated scripts or CSS or other elements.
  • The topic is part of the main page. Large external resources like the TOC, keyword index and search pages are loaded into iFrames where they can load asynchronously (all at the same time).
  • All communication with frames via cross-domain secure browser postMessage protocol so that local WebHelp works normally without a web server on all browsers (even Chrome).
In current testing, these strategies are reducing initial loading times for WebHelp to around 300ms total (including all TOC, Index and Search resources), with the page fully visible in around 100ms or less. Topic load times, including lots of images and toggle initialization, are coming down to around 30ms or less, which is subjectively instantaneous.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply