[thelist] A question on optimization.

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Mon Mar 14 02:56:17 CST 2005


Hi everyone!

As one said apriori, "We developers love to over-optimze things".

Let us consider the following page:

<html>
  <head>
   [6 KB css] 
   <script src="[72.5 KB javascript]"></script>
</head>
<body>
	[57 KB image and 9 KB plain text]
</body>
</html>

Before beginning I'd like clarify that: I know 72K of script and 57K
of image is too much. That's not the point of my discussion.

At the first load of the page, where browser is not putting the cached
js's and images and requesting them directly from the server, here is
what happens:

1. The text (html and css) loads. 
2. The scripts start loading and the images do not load until all the
scripts load. (which might take up to 8 seconds on an 56K connection).

When analyzing the scripts, I found that most of them were being
initialized and executed after page load. So I thought, it would be
better to load the images first (i.e. initialize the look and feel).
And then let the scripts load at the background.
That is to say, reverse 1 and 2 above.

So I generated a new skeleton for the page.

<html>
<head>
 [6 KB css]
 <script src="[some ultimately necessary script]"></script>
</head>
<body>
	[57 KB image and 9 KB plain text]
	<div>
	<script src="[almost 72.5 KB javascript]"></script>
	</div>
</body>
</html>

The page "appears to" load twice faster, and while the user looks at
the images, and reads through the text, the scripts load silenty at
the background.

Considering the limitation that I cannot crunchinate the scripts
(because of maintanability collaboration issues) and I cannot optimze
the images (because the client is a 'me wany eye-candy'), is my
approach relevant?

Opinions?


More information about the thelist mailing list