HTML Optimization and the OpenForum

Status
Not open for further replies.

MrMills

Ars Praefectus
3,727
Moderator
There's a lot of talk about bandwidth bills, and I'm sure Ars Technica and OpenTopic are both very concerned about this issue.

Given that, perhaps it's time for InfoPop to optimize some of the HTML that OpenTopic spits out, and perhaps it's time for Ars Technica to optimize the space taken by JavaScript and other elements specific to it.

For instance:

I took a typical thread page and saved it to my hard drive.

137,843 bytes.

Then I ran Advanced HTML Optimizer on it.

114,439 bytes.

Then I loaded it into EditPlus and replaced all double spaces with single spaces, all double newlines with single newlines, and all line-beginning spaces with nothing.

107,073 bytes.

That means that what I ended up with looked exactly the same as before, but did it with 77.7% of the bytes.

I'm sure more optimization is possible, but the point is that a significant bandwidth savings is possible, one that could benefit modem users as well as saving Ars and InfoPop a fair amount of bandwidth.

For instance, there's a lot of space taken by spaces beginning a line. Sure, that's great on dev machines, but the stuff that finally comes out should be flush with the margin and no extra spaces between lines. I mean, it's not like this stuff has to be human-readable.
 

Bunsen

Ars Tribunus Angusticlavius
7,655
kampers - no...the openforum creates bigtime bandwith bills. BIGTIME. :eek:

that would kick ass if a simple process would reduce bandwith consumption by even a bit...the cumulative results would be enormous.

satangrinv2.gif
 

OneInTen

Well-known member
4,154
You want to reduce bandwidth bills?

Well, start by offering the ability to make all links text only. That removes the img tags, which would save some bandwidth, plus you wouldn't have to serve up some images.

Then, move the email and subscribe to users post links to the profile only - this saves whatever they take up times 30 times a page.

Then remove the edit posts link from posts that aren't your own ... again, typically this will save close to 30 of them per page.

Then scrap the old school font tags and use an external .css file to style the forum, saving even more characters (at the cost of breaking old browsers ... boo hoo, this is supposed to be a tech enthusiasts site - upgrade!)

There are plenty more of these sorts of optimisations that could be done that could make ars' html very light and quick to load.
 

RojBlake

Ars Legatus Legionis
48,129
Subscriptor
OneInTen said, "start by offering the ability to make all links text only. That removes the img tags, which would save some bandwidth, plus you wouldn't have to serve up some images". This is a good point - judging by the discussion about new button designs, a lot of people have expressed a preference for text-only links, which would certainly save on bandwidth. However other people, including me, like a bit of graphics, so it would be good to have an option in Personal Pages that lets you view it with or without, for those that prefer text. But I feel there should be some balance struck between using images and basically having a text only site.

I totally agree with his other suggestions though. Other than the view profile icon, and the edit post (if it's your post) icon, there's no need to have the others, so you could move them to the profile pages.

Another point: I notice that after replying you now get taken to the page you were reading, rather than the first page of the thread. Great change!! How about extending it? If you've already viewed a thread before, and you click it again on the index page, how about it goes to the page you were at the last time you viewed it by default, rather than page 1 again? Of course, you may find that confusing! ;)
 

Kurt

Ars Tribunus Angusticlavius
8,820
Subscriptor++
Unfortunately, removing instances of an image won't decrease bandwidth. Loading up the exact same image 50 times on one page uses the same amount of bandwidth as limiting the occurrences of that image to one.

Additionally, most images are cached so subsequent visits to different pages will not create a bandwidth hit.

The biggest problem is the size of the HTML. The average forum page is 100-150k, most of which could be reduced by going over the code very closely.

Then scrap the old school font tags and use an external .css file to style the forum, saving even more characters (at the cost of breaking old browsers ... boo hoo, this is supposed to be a tech enthusiasts site - upgrade!)

This, however, is a very good point.
 

DB7654321

Ars Scholae Palatinae
1,114
[Crazy plug for mod_gzip :D]

Hmmm... Maybe mod_gzip could help? :)

..Look into it.. It's damn cool!!!

Exerpt(sp?) from my apache log:

192.168.1.6 - - [08/May/2001:23:27:44 -0500] "GET / HTTP/1.1" 200 1951 mod_gzip: DECHUNK:OK In:10895 Out:1951:83pct.

..This page was compressed by 83 percent. ...AND, if you know a certain broswer screws up with compression, you can disable it for that browser type (Identified by User-Agent)! ...It's free, under the Apache license (IIRC) and can be compiled as a DSO module (you don't have to recompile apache to add mod_gzip) from source. :)

...This has been a public service message from a pissed off dialup luser. :)
 

pointwood

Ars Praefectus
5,949
Subscriptor
Then scrap the old school font tags and use an external .css file to style the forum, saving even more characters (at the cost of breaking old browsers ... boo hoo, this is supposed to be a tech enthusiasts site - upgrade!)

I'll second that! CSS rules and they would make it much easier for themselves too!

Try putting this (or any other) thread throu gh the W3 html validator - not nice :(

Most of it is easy to fix, though. It just takes a lot of time to fix :(
 
Well, start by offering the ability to make all links text only. That removes the img tags, which would save some bandwidth, plus you wouldn't have to serve up some images.
The images are not downloaded from Ars servers but from the servers where they are hosted to your browser.

Yeah DB7654321 the mod_gzip is the first thing that came to mind and it would be a good idea too.

--- MWNH ---
 
Unfortunately, removing instances of an image won't decrease bandwidth. Loading up the exact same image 50 times on one page uses the same amount of bandwidth as limiting the occurrences of that image to one.

Yes it will. That image HTML tag takes up bandwidth. Removing instances of it saves bandwidth.

The images are not downloaded from Ars servers but from the servers where they are hosted to your browser.

No, but the reply etc links are hosted by ars. Furthermore, the word "reply" takes up less characters than the tag for that image, so even taking image caching into account, you save bandwidth.
 
No, but the reply etc links are hosted by ars. Furthermore, the word "reply" takes up less characters than the tag for that image, so even taking image caching into account, you save bandwidth.
OK I understand what you mean, but once these are downloaded, they are kept in cache so you don't download them everytime...unless for some reason you don't cache anything in your browser?

--- MWNH ---
 
Good point.

As a matter of interest we are testing mod gzip on this installation with superb results for 99% of browsers. Unfortunately Opera is not one of them.

The results for bandwidth look like a 60% saving by itself.

RE: text links only. This isn't too likely. Whether we like it or not the www world is based on the graphical browser and visual content of that type is only going to increase.

The other points re consolidation of font tags -> CSS and ditto for javascript -- are well taken.
 

pointwood

Ars Praefectus
5,949
Subscriptor
As a matter of interest we are testing mod gzip on this installation with superb results for 99% of browsers. Unfortunately Opera is not one of them.

Well, it should - Opera support it...

The other points re consolidation of font tags -> CSS and ditto for javascript -- are well taken.

It wasn't me that said it, but Im' glad to hear that! CSS (and standards compliant html/xhtml/xml) is what we should have been using years ago...
 

nebosuke

Ars Tribunus Militum
1,800
OK I understand what you mean, but once these are downloaded, they are kept in cache so you don't download them everytime

But, the HTML tags for those images is still downloaded in every page, every time.

unless for some reason you don't cache anything in your browser?

With more and more people getting faster connections, I imagine some of them will either use caching less or not at all. Also, this being a constantly updating forum, how often do people re-load pages here. Images do account for a lot of traffic.

Like it or not though, the majority are pretty determined to have graphical buttons. However, I don't see why the current New Post etc. buttons couldn't be a combination of images and text. The font isn't so distinctive that it needs to be part of the graphic.
 

kampers

Ars Scholae Palatinae
917
i agree re: removing things that i can't use because of user privledges/preferences/status.

for example, i should not be seeing:


  • 'register' link at the top
  • edit links for other people
  • admin options at the bottom
  • two links to the forum home (one above the 'author/message' green bar and one in the same bar as faq/search...)


etc., etc.

oh, and while we're at it, how about putting a link to the ars posting guidelines in the same bar as faq/search? that would be great.
 

MrMills

Ars Praefectus
3,727
Moderator
There's also a lot of repeated JavaScript for each page ... that should go in a separate .js file, with just calls to functions in the main page.

For instance, there are like thirty instances of

code:<HR>
Code:
    if(lastLogin < new Date('Sat, 05 May 2001 21:19:43 GMT-0700')) {
    document.images['POST_ICON_4460999961'].src="/infopop/images1/posticonnew.gif" ;
    }

on each page (and note the superfluous indent). This sets the post icons on/off for each post.

This could be replaced by

code:<HR>
Code:
function setposticon(postdate, postnum) {
if(lastLogin < new Date(postdate)) {
document.images['POST_ICON_'+postnum].src="/infopop/images1/posticonnew.gif";
}

in a common .js file and merely

code:<HR>
Code:
setposticon('Sat, 05 May 2001 21:19:43 GMT-0700',4460999961);

repeated about thirty times.

Taken to its logical extreme, you could have almost the entire page generated by calls to JavaScript functions, which would slim individual pages by a large amount.

There's also a fair amount of code in <noscript> tags that can be safely eliminated for almost everyone.

hux:
I'm sure this would save bandwidth, and that's a good idea all round, but how does the optimization process work? Is it a realtime process, performed as the user requests the page? If so wouldn't that slow down the download? If not, how exactly does it work? Sounds pretty spiffy!! :)

It would involve InfoPop modifying how OpenTopic generates pages, and I would imagine would reduce the load on their end, not increase it.

MichaelF:
As a matter of interest we are testing mod gzip on this installation with superb results for 99% of browsers.

That's a good idea, once the bugs are worked out (I believe it's mod_gzip that's causing the periodic loss of the first 2048 characters of pages).

The other points re consolidation of font tags -> CSS and ditto for javascript -- are well taken.

Great! Consolidating common page code into JavaScript is a great way to save bytes, because a page load can be reduced to the unique text on the page.
 

DB7654321

Ars Scholae Palatinae
1,114
As a matter of interest we are testing mod gzip on this installation with superb results for 99% of browsers. Unfortunately Opera is not one of them.

Great! :) ...Errr, Sorta.

Just out of curiosity, how do you have mod_gzip setup? Mine looks like this:

code:<HR>
Code:
mod_gzip_on                     Yes
mod_gzip_minimum_file_size      1000
mod_gzip_maximum_file_size      0
mod_gzip_maximum_inmem_size     20000
mod_gzip_keep_workfiles         No
mod_gzip_temp_dir               "/tmp"
mod_gzip_dechunk                Yes
mod_gzip_item_include file      "\.pl$"
mod_gzip_item_include file      "\.cgi$"
mod_gzip_item_include mime      "^application/x-httpd-php.*$"
mod_gzip_item_include mime      "text/.*"
#mod_gzip_item_include mime     "image/jpeg"
mod_gzip_item_include handler   server-status
mod_gzip_item_include file      "\.php$"
mod_gzip_item_include handler   server-info
mod_gzip_item_exclude file      "\.css$"
mod_gzip_item_include mime      httpd/unix-directory
mod_gzip_item_exclude file      "\.js$"
mod_gzip_min_http               1001
mod_gzip_item_exclude reqheader "User-agent:.*Konqueror.*"

If Opera isn't working with mod_gzip (which it should, if Opera users can see this page without error (It'll be slow, It's on my dialup accout, and I'm surfing)), why not just exclude it with something like this:

code:<HR>
Code:
 mod_gzip_item_exclude reqheader "User-agent:.*Opera.*"
?
 
OK - a correction. Right now Ars is running a compression algorithm from within an OpenTopicâ„¢ servlet rather than mod_gzip. My apology for the error. Using mod_gzip is an option we're experimenting with but isn't on Ars now.

You'll see a 2.0.2 beta code running here now where, among other things, we've excluded Opera from the compression algorithm. Sorry guys!

We're going to continue working on the compression because as everyone as seen, when it works, it flies.

DB7654321 -- I've copied down your post. Obviously you've got traction in implementing this so we may need to be in touch if we take up mod_gzip. Much appreciated!!

Michael Farris
OpenTopicâ„¢ Product Manager
Infopop Corporation
www.infopop.com
 
Status
Not open for further replies.