Rob Gonda's Blog

CF8 + Ajax need compression!

As you probably know, ColdFusion 8 came out today and it has tons of Ajax/DHTML goodies. It's based on YUI+EXT, which is a great, powerful, scaleable, documented solution... but it weights just too much. A simple cfwindow requires about a 360k JavaScript download ...

I checked the source code, and it's mostly minimized, which means it's hard to reduce the code-base even more... however, you can gzip it. Most/All modern browsers support gzip data, and the difference is huge.

With Apache you can use mod_gzip, but with IIS is slightly more difficult. The best solution IMO is to install a 3rd party tool such as port80 httpZip.

Check out the following comparisons.

CFWINDOW

<cfwindow
    center="true"
    closable="true"
    modal="false"
    resizable="true"
    initshow="true"
    height="200"
    name="window"
    title="UI Window Example"
    width="200">


UNCOMPRESSED
26 requests
0 cached files
0 errors

372244 total bytes
8114 request bytes
364130 response bytes
the average request was 312 bytes
the average response was 14005 bytes

entire session took 7.641 seconds
on average, responses took 0.336 seconds

COMPRESSED
26 requests
0 cached files
0 errors

116218 total bytes
7985 request bytes
108233 response bytes
the average request was 307 bytes
the average response was 4162 bytes

entire session took 3.672 seconds
on average, responses took 0.144 seconds

CFLAYOUT
<cflayout type="border">

  <cflayoutarea position="top" title="Top Layout Area">
  This is the top layout area.
  </cflayoutarea>

  <cflayoutarea position="center">
  This is the center layout area.
  </cflayoutarea>

  <cflayoutarea position="bottom" title="Bottom Layout Area">
  This is the bottom layout area.
  </cflayoutarea>

</cflayout>

UNCOMPRESSED
15 requests
0 cached files
0 errors

357131 total bytes
4584 request bytes
352547 response bytes
the average request was 305 bytes
the average response was 23503 bytes

entire session took 3.609 seconds
on average, responses took 0.223 seconds

COMPRESSED
15 requests
0 cached files
0 errors

102840 total bytes
4645 request bytes
98195 response bytes
the average request was 309 bytes
the average response was 6546 bytes

entire session took 2.64 seconds
on average, responses took 0.165 seconds

CFMENU
<cfmenu name="myMenu">
    <cfmenuitem name="home" display="home" />
    <cfmenuitem name="support" display="support" />
    <cfmenuitem name="about" display="about" />
</cfmenu>


 8 requests
0 cached files
0 errors

215463 total bytes
2366 request bytes
213097 response bytes
the average request was 295 bytes
the average response was 26637 bytes

entire session took 2.438 seconds
on average, responses took 0.289 seconds


8 requests
0 cached files
0 errors

54543 total bytes
2399 request bytes
52144 response bytes
the average request was 299 bytes
the average response was 6518 bytes

entire session took 1.562 seconds
on average, responses took 0.168 seconds


Pretty impressive huh?

So in conclusion, you must compression your scripts to make it half-decent for your users... ColdFusion provided a very powerful tool, now it's up to you to make the best of it.

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?1A0581A2-FA23-EF0D-A3E6FE340909B4A6

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
This blog is running version 5.9.003. Contact Blog Owner