Jump to content

JavaScript Minification what are your opinions on it?


Ninjakreborn

Recommended Posts

I think that its a pain in the arse, because then you have to keep another un-minified copy of it. Everytime you want to modify it, you have to minify it again. The only app I could find for that is a CLI one threw MS-DOS. So I dont even bother with it myself. Unless I had so much traffic that minifying it could save like a least  1/mbps.

Link to comment
Share on other sites

I agree.  I minify when the client requests it.  When I have a choice I end up using the original JS files.  The reason I don't like minifying is because I like being able to look through the code.  I only do it when the client requests it.  I also sometimes modify the base javascript file or extend them so I need to see them to be able to do that.

Link to comment
Share on other sites

I really don't think it worth the hassle unless you have a lot of traffic that it actually might save a noticeable about of bandwidth.  Something I do go threw the trouble off  is too turn all the icons and parts of the template into CSS sprites, and also put all the sprites threw PNGCrush.  That often adds noticeable loading improvements to the site and descreases the HTTP requests to the website. HTTP requests are expensive, specially with Apache, I think one slot take 15MB ram on my server, So I want them to get everything as quick as possible and close the slot.

Link to comment
Share on other sites

Yeah, If you use a library such as jQuery (which already comes minified) than it is a handy solution, especially if you're needing to fit something that requires fast loading (AJAX page loading etc) as it can save maybe 1-50ms. This can be a benefit to the user's appearance. But yeah, I hate having to keep separate copies, So I just shoved all my JS into a PHP file and used gzcompress  ;)

Link to comment
Share on other sites

I really don't think it worth the hassle unless you have a lot of traffic that it actually might save a noticeable about of bandwidth.  Something I do go threw the trouble off  is too turn all the icons and parts of the template into CSS sprites, and also put all the sprites threw PNGCrush.  That often adds noticeable loading improvements to the site and descreases the HTTP requests to the website. HTTP requests are expensive, specially with Apache, I think one slot take 15MB ram on my server, So I want them to get everything as quick as possible and close the slot.

 

1 request takes 15MB?  What in the world kind of config do you have going?!

Yeah, If you use a library such as jQuery (which already comes minified) than it is a handy solution, especially if you're needing to fit something that requires fast loading (AJAX page loading etc) as it can save maybe 1-50ms. This can be a benefit to the user's appearance. But yeah, I hate having to keep separate copies, So I just shoved all my JS into a PHP file and used gzcompress  ;)

 

Why not just use mod_deflate instead of doing it at a PHP level?

 

 

 

 

Anyway, I don't typically minify my JS.  Basically 'cause I'm lazy :).

Link to comment
Share on other sites

PHPUnderControl is a great build tool built on top of cruisecontrol/ant that I've been using for a little while now for continuous integration. Its easy to add target's to the build process to do things like minify your Javascript / remove whitespace from CSS.

 

That way its all simply taken care of when you make a commit.

Link to comment
Share on other sites

I really don't think it worth the hassle unless you have a lot of traffic that it actually might save a noticeable about of bandwidth.  Something I do go threw the trouble off  is too turn all the icons and parts of the template into CSS sprites, and also put all the sprites threw PNGCrush.  That often adds noticeable loading improvements to the site and descreases the HTTP requests to the website.

 

I would personally think that the size of the javascript in question could be a factor (as well as obviously the traffic involved). Some performance whores tend to try and merge some scripts together to cut down on http requests (if I was a javascripter, I would do the same - being that if I could combine some scripts, I would). I don't think there would necessarily be huge savings, but any savings doesn't hurt (especially when dealing with reducing http requests -  and on that note, I too make use of css sprite sheets.. so many sites out there assume that a collection of smaller separate images is better for performance than having those related images grouped together as one image. They don't take into account http requests, let alone that each individual file has to contain it's own information like colour tables and whatnot, thus the sum of a larger image can be smaller than the sum of all its equivalent smaller individual files).

 

At one point I did have minified files (namely css), but I can't recall if I am currently using those or the orginials. Either way, there are plenty of sites out there that stand to gain plenty of performance from applying Yahoo's best practices. Some enhancements are server side, some are not. But as you mentioned, if the traffic is small, then it will be less of an impact as opposed to sites that do have heavy traffic.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.