Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Whitespace removal in html generated by cgi

Thread Tools

Whitespace removal in html generated by cgi

Chris Mattern
Posts: n/a
Gregory Toomey wrote:
> It was a dark and stormy night, and Eric J. Roode managed to scribble:
>>Hash: SHA1
>>Gregory Toomey <(E-Mail Removed)> wrote in
>>news:3072218.31r3eYUQgx@gregs- web-hosting-and-pickle-farming:
>>>People hate waiting for pages to load, especially for people on dialup.

>>Have you verified that the extra time your CGI scripts take to execute is
>>less than the transfer time of the spaces you are eliminating?

> The server I use for cgi is about 2.6GHz and averages 20% CPU utilisation.
> Running the script to remove whitespace takes under 1 second for 1000 lines of HTML,
> and does not increase the load to any discernable extent.
> The database-driven cgi I use is disk IO bound, not CPU bound.

Which doesn't answer the question. The question isn't "Are you overloading the
server?", the question is "Are your users waiting longer for you to remove the
whitespace than they would wait for the whitespace to download?" Assuming there
is ten bytes of removable whitespace per line (which would be rather a lot),
then the whitespace in 1000 lines takes less than two seconds to download on
a 56K modem. It would take a small fraction of a second with broadband. It
scarcely seems worth the effort.

Chris Mattern

Reply With Quote
Louis Erickson
Posts: n/a
Gregory Toomey <(E-Mail Removed)> wrote:

: It was a dark and stormy night, and Eric J. Roode managed to scribble:
:> What is the goal of this? Reducing the amount of data that is
:> transmitted to the client browser?

: Yes.

:>If so, you would probably be better
:> off compressing the output with gzip -- all major browsers support gzip
:> compressed data.

: Yes I use Apache with gzip so that's another level of compression.

If you're gzipping the output stream, then the removal of spaces isn't likely
to change your transmission size significantly, if at all. The compressor
will flatten them right out, without risking the content of the HTML.

Also note that if you have a CGI that sends back something besides HTML,
such as image or sound data, this will completely screw it up.

Louis Erickson - Removed) -

Andrea: Unhappy the land that has no heroes.
Galileo: No, unhappy the land that needs heroes.
-- Bertolt Brecht, "Life of Galileo"
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Splitting text at whitespace but keeping the whitespace in thereturned list MRAB Python 3 01-26-2010 11:36 PM
Structure using whitespace vs logical whitespace Python 10 12-16-2008 03:51 PM
(Ab)using class CGI as non-CGI HTML generator? Josef 'Jupp' Schugt Ruby 3 03-06-2005 11:34 AM
Whitespace where I don't want whitespace! Oli Filth HTML 9 01-17-2005 08:47 PM
[JSTL] Generated HTML too large (whitespace) Karsten Wutzke Java 2 11-04-2003 06:07 PM