Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion
Author Message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Wed Jan 23, 2008 10:41 pm Reply with quote

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 Only registered users can see links on this board! Get registered or login! 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 Only registered users can see links on this board! Get registered or login!? (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? Only registered users can see links on this board! Get registered or login! 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?

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Jan 24, 2008 9:09 pm Reply with quote

It's really scary. Maybe ESP? Or is it PHP killing me 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 Wink
 
View user's profile Send private message
kguske







PostPosted: Thu Jan 24, 2008 11:22 pm Reply with quote

You mean, instead of us both doing so, as with htaccesser? Cool
 
kguske







PostPosted: Fri Jan 25, 2008 10:39 am Reply with quote

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: 928

PostPosted: Fri Jan 25, 2008 10:54 am Reply with quote

No....I know I am intersted. My page load times SUX.

Dawg
 
View user's profile Send private message
technocrat
Life Cycles Becoming CPU Cycles



Joined: Jul 07, 2005
Posts: 511

PostPosted: Fri Jan 25, 2008 12:06 pm Reply with quote

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>
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sun Jan 27, 2008 8:37 am Reply with quote

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.
 
View user's profile Send private message Send e-mail
djmaze
Subject Matter Expert



Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv

PostPosted: Tue Feb 26, 2008 12:20 pm Reply with quote

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: а
 
View user's profile Send private message Visit poster's website
kguske







PostPosted: Tue Feb 26, 2008 4:44 pm Reply with quote

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







PostPosted: Tue Feb 26, 2008 4:55 pm Reply with quote

FF2
 
kguske







PostPosted: Tue Feb 26, 2008 5:41 pm Reply with quote

Strange. I didn't have problems loading the compressed stuff on my site, where it's still compressed.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©