| Author |
Message |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Wed Jan 23, 2008 10:41 pm |
|
Based on Guardian's recommendation, I installed the FireBug and YSlow extensions on Firefox. REALLY nice (though initially a tad confusing).
Of course, my recent problems with page load time (mostly, I think, due to an external JS file on another server) led me to test performance of a site first. Lots of bad grades, I'm afraid. One of the worst was uncompressed local JS files.
A quick search led to to handle it through most browsers (another addition to dot htaccess generator?). One JS went from 11K to 3K - NICE. Even better - when I view the JS (and presumably CSS, though I haven't tested that yet), using the JSView Firefox extension, the source is uncompressed. NICER! Although initial tests indicated that page generation time increased, subsequent tests indicated no substantial different in page generation time.
What if I "minified" it first, using something like ? (there is also a PHP version that could do this on the fly) By removing comments and spacing, the 11K script went to 9K, and a 7K script went to 4K. Adding gz compression put these at 2K and 1K. So, these 2 JS files went from 18K to 3K! NICEST! (note: don't try viewing these scripts online)
Could there be an even better way? This looks promising, even if it requires PHP 5.2+ (another reason to upgrade?). But is this better? Not sure yet, though the caching and 304 responses are appealing. It claims to work with PHP gz modules, but it's not clear if that's a benefit. If the files are compressed, does minify do its thing to the uncompressed version? If so, that might be better for script writers since they wouldn't need to include both compressed and uncompressed versions - they could leave in comments for maintainability, compress and minify. Then again, we could just separate scripts for compressed / uncompressed sites.
So, before I invest any more time on this, has anyone else looked at this / found better options? |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Jan 24, 2008 9:09 pm |
|
It's really scary. Maybe ESP? Or is it PHP Anyway, for the last couple of weeks I've been all over the net looking into JS compressors. But, due to the release date I had to place it on the back burner. I'll just let you hound dog this one  |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Thu Jan 24, 2008 11:22 pm |
|
You mean, instead of us both doing so, as with htaccesser?  |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Fri Jan 25, 2008 10:39 am |
|
If it's just the two of us that are interested, I'll probably put it on the back burner, too. |
|
|
|
 |
Dawg RavenNuke(tm) Development Team

Joined: Nov 07, 2003 Posts: 889
|
Posted:
Fri Jan 25, 2008 10:54 am |
|
No....I know I am intersted. My page load times SUX.
Dawg |
|
|
|
 |
technocrat Life Cycles Becoming CPU Cycles

Joined: Jul 07, 2005 Posts: 511
|
Posted:
Fri Jan 25, 2008 12:06 pm |
|
The js minifying seems to only add minor speed increases. I couldn't get the gz compression to work for me I am not sure why.
I did notice a strong improvement by adding cache controls to the .htaccess file.
| Code: | <IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(ico|flv|pdf|mov|mp3|wmv|ppt)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
# Set up caching on media files for 1 week
<FilesMatch "\.(gif|jpg|jpeg|png|swf|bmp)$">
ExpiresDefault A604800
Header append Cache-Control "public"
</FilesMatch>
# Set up 2 Hour caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "private, proxy-revalidate, must-revalidate"
</FilesMatch>
</IfModule> |
|
|
|
|
 |
Guardian2003 Site Admin

Joined: Aug 28, 2003 Posts: 6373 Location: Vsetin, Czech Republic
|
Posted:
Sun Jan 27, 2008 8:37 am |
|
So far I have only used the extension to help quatify potential problems and bottlenecks. Unfortunately, I have not had the time to delve into it any deeper with profiling etc to compare one method against another.
They are certainly very useful tools though and hopefully soon I'll be able to follow through. |
|
|
|
 |
djmaze Subject Matter Expert

Joined: May 15, 2004 Posts: 689 Location: http://tinyurl.com/5z8dmv
|
Posted:
Tue Feb 26, 2008 12:20 pm |
|
I wrote a very dаmn good compressor.
Problem is: you need to write dаmn good 100% valid JavaScript!
It doesn't scramble the function names like many others, it just rips out all spaces and uses gzip compression.
Problem with function name scrambling is that you could get 2 functions (each in a file) with the same name :p
P.S.: dámn is not allowed, and there are 1000's of ways to still write the word. including the following unicode character that i used but your browser probably doesn't understand: а |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Tue Feb 26, 2008 4:44 pm |
|
djmaze, I'm pretty sure that's how (php) minify works (ie, it doesn't scramble).
Technocrat - which browser were you using where gz compression didn't work? |
|
|
|
 |
technocrat Life Cycles Becoming CPU Cycles

Joined: Jul 07, 2005 Posts: 511
|
Posted:
Tue Feb 26, 2008 4:55 pm |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Tue Feb 26, 2008 5:41 pm |
|
Strange. I didn't have problems loading the compressed stuff on my site, where it's still compressed. |
|
|
|
 |
|
|
|
|