[thelist] PAGE OPTIMIZATION: source readability v. download weight

Michael Kimsal michael at tapinternet.com
Wed Jun 12 14:05:01 CDT 2002


Chris W. Parker wrote:
> hi!
>
> i was toying with making my pages as small as possible and found that on
> some of the longer pages i can take off about 10k of space characters
> from the formatting of the code.
>
> for example...
>
> <table>
>   <tr>
>     <td>hello world!</td>
>   </tr>
> </table>
>
> becomes...
>
> <table>
> <tr>
> <td>hello world!</td>
> </tr>
> </table>
>
> -----
>
> now i think the second one is VERY ugly and i do not want to do it that
> way. recently i came across a bookmarklet that measures the 'weight' of
> the page you are viewing. i haven't examined the link itself, so i don't
> know what it is counting for the weight, but i can say that if i remove
> one character it goes down by 1 byte. so it's close enough.
>
> anyways... i've almost become obsessed with seing this number drop as
> low as i can get it.
> <nervous-crazy-laugh>hahahaha!!</nervous-crazy-laugh>
>
> usually i use two spaces to indent mine tags, but now i'm thinking maybe
> i'll use just one. that will cutout at least half of course.
>
> but my question to you people is "what's more important? the ability to
> read the source easily through organization and spacing, or shaving off
> almost 10k (depending on the length of the page of course) from the page
> size?"
>
> news of tools, utilities, suggestions, ideas, etc. are welcome.


Our PHP app server LogiCreate can do one of two things optionally to
help shave off download time:

1.  Gzip the data coming down
2.  Strip whitespace

Actually, #3 would be do both of those.  It's about 2 lines of code in
the template handling code, and can often give good results.  If you've
a basic page, it doesn't help much, but for larger pages it does wonders
(as you're saying - 10k).  The benefit of having an app server do this
is that you can switch it off.  Keep the whitespace for debugging
purposes - strip the whitespace in 'production'.  You still keep
your template files with the whitespace intact for reediting purposes.

Yes, it's a shameless plug, but I hope it at least gives you
some ideas.  ;)

Michael Kimsal
http://www.logicreate.com
734-480-9961







More information about the thelist mailing list