![]() |
Page Output Compression - Whitespace stripper.
No longer supported by the author.
|
this have been done in another hack related to templates compression...
most of the time, it's not good to have such a feature because html is not written well, or is not xhtml relevent... |
Quote:
Quote:
As both HTML and XHTML renderers ignore white space the hack can't possibly do anything that the HTML or XHTML wasn't already doing. I've tested it on my forum and been sure to not upset anything anywhere... I only replace multiple white spaces with a single space... there is no chance a renderering engine will alter what it does because of this. If I didn't put back 1 white space for the many taken out, then I would agree that I might be affecting the page display or something... as someone might've relied on spacing. However, I leave a single space in there for that reason. Please show me how my hack does what you imply. |
I'm using 3.0.0, and I had to do something else, and still worked.
You see, I didn't find: PHP Code:
PHP Code:
PHP Code:
|
Quote:
I've just checked the default file from Jelsoft for vBulletin 3.0.3 and the code as I've pasted it is on line 1852. So it is there when shipped. You must've removed it at some point, maybe for another hack? Well... no worries. If it didn't have the if (DB_QUERIES) block then you would be best to place the hack code BEFORE the $pageendtime variable. Otherwise the stat you get telling you how long the page took to load will not reflect the inclusion of the hack, as the $pageendtime is literally the timestamp of the page as it finishes being generated. |
Hehe... I just noticed you said 3.0.0. Well, the hack version does say 3.0.3 ;)
It works anyway... just place the hack BEFORE the $pageendtime variable is set :) |
That won't work if someone uses the <pre> tag, which utilizes whitespace for formatting.
|
Quote:
However if you have a tech site in which you paste lots of HTML, etc... and you want to preserve space within that. Then you'd be best not using this hack at all ;) |
Simple and effective. Oh and anyone that has VB3 MicroStats hack installed will not be able to find
Code:
if (DB_QUERIES) Code:
if (DB_QUERIES) |
wow - this makes every page load much faster
thanks very much, great hack. |
Quote:
|
Quote:
how? [high]* turbidblue is interested ;)[/high] |
Quote:
AdminCP > vBulletin Options > Style & Language Settings > Store CSS Stylesheets as Files? = Yes Note that vBulletin needs to be able to write the files to the folder: Quote:
You can usually set permissions via FTP programs or SFTP... but it can always be done from SSH or Telnet :) |
Quote:
|
The full version screws up nicely formatted posts when you edit them, so I have used the "lite" version which doesn't do this.
|
Quote:
|
Quote:
|
Quote:
To offer a proof I've done the following: wget my forum index.php both compressed using the now default non-aggressive regexp, and also without this hack applied. The sizes of the two files: 37,732 bytes = Compressed file 41,348 bytes = Uncompressed file A 9% reduction in filesize. I then ran gzip from within SSH, this should be the same as PHP gzip'ing them or a close approximation thereof: 6,748 bytes = Compressed + GZIP 8,102 bytes = Uncompressed + GZIP A 20% reduction in final filesize. The additional reduction of the size is higher than merely the white space being stripped and is an indicator that doing this does offer a benefit to GZIP. So the compressed page (exactly the same HTML but without white space) ends up being 20% lighter with GZIP'ing than the non-compressed page. Of course, the mileage varies on every page and with each style that you use. I should point out that the above was run against my current forum homepage which is not the default vBulletin style and that I've hacked my page quite a lot. So the filesize of your page and the amount it compresses and the amount it GZIPs are all factors depending on your configuration and the amount of whitespace in a page, etc. The worst I've seen from this hack is a mere 3% reduction in file size on some of the smaller pages (such as the error messages). The biggest benefit isn't the saved 1k of traffic... but the speed at which the rendering increases. Whether that is because the file transfered quicker, of the DHTML engine didn't have to work so hard ignoring whitespace, etc... I simply do not know... but it does appear to render faster and that is my prime goal :) |
Of course... all of the above is simply a bigger advert for turning on GZIP than using this hack ;)
If anyone doesn't have GZIP turned on in their vBulletin... I suggest you do that first :) |
Ok, convinced. Thanks ;)
|
Unfortunately, this will also strip white space when editing posts. That's NOT good.
|
Quote:
However the basic non-aggressive one will one strip excess space between ">" and "<". Unless you have HTML in your posts this shouldn't matter. Does this impact anything? Such as the WYSIWYG editor? I've been running it for a little while on my site and I haven't noticed any detrimental effects when editing posts. If you can give a detailed example I'll have a look and see what can be done about it. My site runs with a history of all edits (an edit log), so I can diff between changes to see how this effects it. |
this lowered my homepage size by 3kb, it's a quick hack so worth the small effot :)
|
Essentially it strips all returns out of posts when editing. In general, it's not a big issue but for long posts it's a little tiresome to have to go insert returns again. I did have the more aggressive version installed. I'll try the lesser one and see if that helps a little.
|
Quote:
Quote:
|
This hack have a good concept; but it is not the best way to preserve bandwidth...
For example; if your site is not webmaster oriented, your members will be unlikely to post as much HTML/other contents that needs trimming, thus it wouldn't affect your site as much. If your site is webmaster oriented, you will want to preserve the code the way it is (for demonstration and code representation purpose). The members will have a hard time trying to learn: Code:
<? Code:
<? if (!$happy){print $sad_string;}?> And that's only a basic example, think what chaos it'd do with stuff like: Code:
if (!$a):$b or die(print($c)) |
Oh absolutely.
But bandwidth preservation wasn't the #1 priority... delivery to the rendering engine and reduction of work for the rendering engine was. If you have a site that is going to use CODE tags, etc... then use the now defaulted 'lite' version. For those of you who do not post code, etc in CODE tags, and care not for <pre> tags... then the aggressive version will suit your needs and save a few more spaces. |
And if you want to save bandwidth:
* Turn on GZIP * Remove images where you consider them excess * look at removing any redundent tags in the templates... you optimise the HTML ;) Etc. Removing a few images will do more than this does... but this will help it display faster ;) |
for those having problems with the edit posts and new threads posts, PMS etc etc i have made this little addition that will switch to the light version if you view them pages (i think it works lol)
PHP Code:
i wrote that out really quick so sorry if its not coded proppa but you get the idea ;) |
I clicked Install !!!!!!!!!!!!! terrific! :laugh: :banana:
|
Quote:
Code:
$thisscriptis = array( |
yeah mystics is right i did change it on my site and forgot to change it on here i will update that post :)
|
[high]* Mosh clicks install (Mystics version)
[/high] But credits to buro9 too, for getting me to read the entire thread through in the 1st place as it is a very interesting way of speeding things up. JD :) |
/me installs.
I can see the difference, page loads faster for me Thankx for this great 1 line hack REgards, |
Quote:
never mind i guess me thinking up the whole THIS_SCRIPT idea dont count and i already had the fix on my site i just forgot to update here :( but as always thanks for mystics pointing it out to everyone else. last but not least you wll also want to add private into the array so it does not screw up private messages find Code:
'editpost', Code:
'private', Mickie D |
Very nice! forum pages are noticably snappier.
Can this be implemented on other non VB php pages? How would that be done? I'm sure the rest of my site could benefit from this. :) *installed* |
Great! Thank you very much.
|
I've got https://vborg.vbsupport.ru/showthread.php?t=62173 installed
...which splits up the two bits of line that you say to add the code before... so can you look at this hack and then tell me where i'd put your code. Thanks |
Quote:
Hehehehe, hey thanked Mystics because it was his exact code I used :) Thank you also Mickie D, cause I am now going to add the 'private', line to it. :) JD :) |
Quote:
|
All times are GMT. The time now is 10:08 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|