Welcome Guest, Not a member yet? Register   Sign In
Remove all whitespace from output.
#1

[eluser]Daniel Samuels[/eluser]
This is a modification of the Output class. All it does is simply remove all CSS / JS comments and all whitespace.

There is one bug I am aware of, but not sure how to go about fixing. The bug is if a line of Javascript doesn't end with a semi-colon when it should, there will be a parse error.

To use, simply put the file into application/libraries
#2

[eluser]xwero[/eluser]
I did a similar thing a whole wile ago and the comments i got were that this sort of thing should be done by the developer and not when the page is rendering. There were also comments about the fact that it is micro performance management, the performance gain you have by shaving the bits off are lost by the removal process.
#3

[eluser]Daniel Samuels[/eluser]
[quote author="xwero" date="1235169790"]the performance gain you have by shaving the bits off are lost by the removal process.[/quote]
Does that apply even if the pages are cached?

The other thing to think about it the data transfer saved from the server to the client - it's now all about processing time, as that's not a huge difference (depending on the amount of content of content of course).

Saving 100KB may not seem a lot, but 100 page loads and you've saved almost 1MB of data transfer, keep multiplying that and you soon see that you are saving a lot of data transfer.
#4

[eluser]Jon W[/eluser]
It wouldn't be the first place I'd check to make improvements to front end performance -- chances are output is being gzipped between client & server, and gzip is good at compressing whitespace. If bandwidth costs are a consideration, and I wasn't gzipping, I'd use something like this.

If generating JS or CSS files dynamically, something like this would be good as a part of dynamic minifier. Smaller files contribute toward better JS performance in the client, which can sometimes be a significant issue.

More on these issues;
http://developer.yahoo.com/performance/rules.html




Theme © iAndrew 2016 - Forum software by © MyBB