high performance site and prototype

39 views
Skip to first unread message

ACES Direct

unread,
Jul 21, 2008, 5:27:38 AM7/21/08
to Prototype & script.aculo.us
Hi,

The current prototype.js is about 130kb, on a high performance site
this is quite a lot. Does anyone have an idea how I can only use the
Ajax portion of prototype.js so the .js file gets smaller?

Thanks,

Greetings, Bram

Christophe Porteneuve

unread,
Jul 21, 2008, 6:11:02 AM7/21/08
to prototype-s...@googlegroups.com
Hey Bram,

ACES Direct a écrit :


> The current prototype.js is about 130kb, on a high performance site
> this is quite a lot. Does anyone have an idea how I can only use the
> Ajax portion of prototype.js so the .js file gets smaller?

Best best: offload it to Google's CDN using their "Ajax Libraries APIs"
offer [1].

Otherwise, you can just configure your web server to GZip it (~30KB) and
set a long cache expiry to it, that does nicely as well.

[1] http://code.google.com/apis/ajaxlibs/documentation/

--
Christophe Porteneuve aka TDD
t...@tddsworld.com

CoolEsh

unread,
Jul 22, 2008, 7:25:18 AM7/22/08
to Prototype & script.aculo.us
Or you can make compression with one of the known progs, that removes
comments, freespaces etc and get the version about 76 kb.

David Dashifen Kees

unread,
Jul 22, 2008, 9:53:26 AM7/22/08
to prototype-s...@googlegroups.com
Configuring your web server to gzip it is easier than you'd think.  If you're interested, here's a link.  IT's for gzipping CSS, but with some tweaks you can apply it to javascript files, too.  It relies on .htaccess files, so you'll need the appropriate server environment.



 - Dash -
--
David Dashifen Kees

jdalton

unread,
Jul 22, 2008, 6:08:27 PM7/22/08
to Prototype & script.aculo.us


I totally agree with gzipping.
Minified and gzipped Prototype is 20.7kb.

Currently YUI Compressor is compatible with Prototype 1.6.0.2 and its
use of the $super variable.
I have also modified a version of Dean Edwards packer 3 to support the
$super variable.

http://protosafe.googlecode.com/files/protopack_v2.19b.zip (package of
pre minified prototype and scriptaculous versions)
http://xnme.exofire.net/2008/05/speed-up-your-website-quick/ (how to
use mod deflate)

Here is an example .htaccess addition:

# References:
# http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/
# http://xnme.exofire.net/2008/05/21/speed-up-your-website-quick/
# http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

<IfModule mode_deflate.c>

AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml
application/x-javascript
DeflateCompressionLevel 9

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</IfModule>


- JDD
Reply all
Reply to author
Forward
0 new messages