vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Realtime Template Compressor: Reduces page sizes, loads pages faster, saves bandwidth (https://vborg.vbsupport.ru/showthread.php?t=83248)

ShiningArcanine 06-16-2005 10:00 PM

Realtime Template Compressor: Reduces page sizes, loads pages faster, saves bandwidth
 
This is a port of Logican's Realtime Template Compressor hack from vBulletin 2.2.x to vBulletin 3.5.0 Beta 1. I wrote this by rewriting a version of the original hack, that I wrote for my forums when they ran 3.0.x, so that it would function as a plugin for 3.5.0.

I had originally sent this to Logican for him to release it but he replied granting me permission to release it; hence why I'm releasing this.

Installation is very simple. Just import the plugin via vBulletin's "Download / Upload Plugins" page in the Plugin System in the Admin Control Panel and you're done.

I'll try to correct any bugs that you might find. Let me know if you like this plugin and don't forget to click the install link if you install this.

Update History


Version 1.1.0: The expression was replaced with a more efficient one that increases the compression level from approximately 1-2% to approximately 4-8%.
Version 1.0.0: Initial Release

womensden 06-16-2005 10:57 PM

Forgetting something?

Robert Basil 06-16-2005 11:09 PM

Yup, looks like the xml file might help. ;)

Martin 06-17-2005 12:17 AM

Quote:

Originally Posted by Sportbikeworld
Yup, looks like the xml file might help. ;)

Mebbe he's practicing for April Fool's Day?;)

fraghappy 06-17-2005 12:52 AM

I'll be interested to see how effective this is after he gets around to giving us the xml file. ;)

Martin 06-17-2005 01:51 AM

Quote:

Originally Posted by fraghappy
I'll be interested to see how effective this is after he gets around to giving us the xml file. ;)

It's there. It's just been Real Time Compressed so tightly that it's invisible to the naked eye as a demonstration of the awesome compression capability he's bringing us.

Andreas 06-17-2005 01:57 AM

Quote:

Originally Posted by Martin
It's there. It's just been Real Time Compressed so tightly that it's invisible to the naked eye as a demonstration of the awesome compression capability he's bringing us.

LOL. Anyway, the idea of removing whitespaces is good - saves 5-10% Bandwidth (even with GZip), and the pages are being rendered faster.

Marco van Herwaarden 06-17-2005 03:52 AM

Did you contact the original author for permission to port his hack?

kall 06-17-2005 04:50 AM

Quote:

Originally Posted by MarcoH64
Did you contact the original author for permission to port his hack?

Quote:

Originally Posted by First Post
I had originally sent this to Logican for him to release it but he replied granting me permission to release it; hence why I'm releasing this.

That would tend to suggest so.

jpt62089 06-17-2005 06:03 AM

wow I love this hack! its.... its.... just....... AMAZING! lol :p

so when do we get our hands on the XML? vB 10? hehe :P

Marco van Herwaarden 06-17-2005 06:28 AM

Oops

/me makes a mental note to read better before replying

ultranerds 06-17-2005 10:47 AM

Quote:

Originally Posted by jpt62089
wow I love this hack! its.... its.... just....... AMAZING! lol :p

so when do we get our hands on the XML? vB 10? hehe :P

Maybe he's sleeping <G> (only posted it earlier today ;)).

Cheers

Andy

ShiningArcanine 06-17-2005 05:06 PM

Quote:

Originally Posted by womensden
Forgetting something?

Sorry guys, I could have sworn I attached this. I guess I clicked the wrong submit button. ^_^;;

Anyway, it is attached now. It uses the same perl expression Logician's original hack uses and much of the code is the same. I simply made it work with vBulletin 3.5.0 Beta 1. I'm thinking of writing a new expression for more aggressive compression but my experience with expressions is limited so that'll have to wait until I have some freetime on my hands.

womensden 06-17-2005 05:13 PM

*Installing now*

Thanks. I didn't think you did it on purpose. ;)

ShiningArcanine 06-17-2005 05:23 PM

Quote:

Originally Posted by womensden
*Installing now*

Thanks. I didn't think you did it on purpose. ;)

I didn't think you did. :)

Guys, I'm still playing with this but if you open the xml file, find:

Quote:

/(>)(s*)(\r\n)*(s*)(<)/
Replace it with:

Quote:

/(>)(\s*)(\r\n)*(\s*)(<)/
And then upload that file instead, the compression soars from 1-2% to 8-10%. I'm still playing with the expression through so you might want to wait until I finish playing with it and release version 1.1.0.

womensden 06-17-2005 05:28 PM

That messed up my tables.

ShiningArcanine 06-17-2005 05:41 PM

Quote:

Originally Posted by womensden
That messed up my tables.

Did you edit the XML file and then upload it or did you edit the plugin from the Plugin Manager? There is a problem in vBulletin 3.5.0 Beta 1 when it comes to storing expressions. They seem to get parsed somewhere along the line; hence why I said to edit the xml file.

womensden 06-17-2005 05:45 PM

oh, ok. I'll try that.

womensden 06-17-2005 05:47 PM

That worked! Thanks

mholtum 06-17-2005 06:13 PM

[Output: 36.08 Kb. compressed to 35.71 Kb. by saving 0.37 Kb. (1.03%)]

That is all I am getting. But if I edit the file, the forums get hosed.

Now I am getting:
[Output: 36.08 Kb. compressed to 29.16 Kb. by saving 6.92 Kb. (19.19%)]

womensden 06-17-2005 06:30 PM

I just noticed that in the "new posts" page, the topic titles are crammed against the "go to first new post" icon. There is no space in between. It's fine everywhere else though.

ShiningArcanine 06-17-2005 07:32 PM

That alternate expression was experimental, which is why I said that I was still playing with it. Here is the new one I'm playing with:

Quote:

/(?(?=\r\n)\s)/
It doesn't compress as well but it doesn't seem to remove any necessary whitespaces so it is a strong candidate for the expression I'm putting in 1.1.0 (as I'm not happy with the current level of compression).

ShiningArcanine 06-17-2005 08:10 PM

It seems that I made writing expressions more complicated than it needed to be. ^_^;;

I wrote something entirely new that I think will be much more efficient so I've released version 1.1.0.

Andreas 06-17-2005 08:15 PM

Your current regex kills whitespaces that are there intentionally.
And you could achieve higher compression if you remove HTML comments.
However, this might cause problems with JavaScript then.

ShiningArcanine 06-17-2005 08:39 PM

KirbyDE, aren't all of the whitespaces there intentionally? The regex in 1.0.0 was Logician's original regex but it didn't compress things well enough and my attempts at an advanced regex compressed things so well that it killed whitespaces that are necessary for the presentation so I wrote a simpler regex that strips the whitespaces at the beginning of each line.

It doesn't have any effect on how you view the page unless you're viewing the XHTML. If you were viewing the XHTML, you would not have any level of template compression enabled on your forums.

I have this installed on my forums if you want to check it out:

http://www.pokemonfanuniverse.com/forums/

By the way, thanks for the tip regarding the comments. I was considering stripping them in a new version but I didn't realize that stripping them might affect javascript. Looking at the syntax Jelsoft used I could probably strip them either by ensuring they're on a single line or by also requring the whitespace found after "<!--" in comments but not in the javascript (from what I can see).

Edit: Also, if anyone is interested in why vBulletin strips slashes from the plugin upon submit/edit, they'll want to check out this bug report at vBulletin.com:

http://www.vbulletin.com/forum/bugs3...view&bugid=184

It should be fixed in vBulletin 3.5.0 Beta 2 from what I can gather.

Andreas 06-17-2005 08:53 PM

What about that
Code:

The following line has 4 spaces at the beginning
    Test


ShiningArcanine 06-17-2005 09:22 PM

Quote:

Originally Posted by KirbyDE
What about that
Code:

The following line has 4 spaces at the beginning
    Test


I'm not aware of any stock code in vBulletin written like that and to be honest, that is supposed to use &nbsp; rather than standard whitespaces. Not to mention modern browsers display one whitespace instead of several consecutive whitespaces in HTML web pages even if there are several consecutive whitespaces.

Andreas 06-17-2005 10:13 PM

This is the stock [code] Tag :)
It generates <pre>-Tags, which should preserve whitespaces - but you strip them out.

ShiningArcanine 06-17-2005 10:36 PM

Quote:

Originally Posted by KirbyDE
This is the stock [code] Tag :)
It generates <pre>-Tags, which should preserve whitespaces - but you strip them out.

That changes things. Are you proposing a better way of doing it that won't strip those whitespaces or are you leaving it up to me?

By the way, shouldn't Logician's orignal regex also have stripped out those whitespaces?

ja3 06-18-2005 06:47 AM

I use
$output=preg_replace ('/(\s*)\r\n(\s*)/', "", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

and get about 15% compression, don't know why you still need the \r\n? :)

mholtum 06-18-2005 06:48 AM

[Output: 38.53 Kb. compressed to 31.02 Kb. by saving 7.51 Kb. (19.50%)] is what I am getting from the code he posted later in the thread
:)

nexialys 06-18-2005 12:16 PM

i find strange that this technique was released earlyer for 3.0, and now reproduced it, but in no way Jelsoft thought of adding any of the template compression techniques released here yet...

am i wrong, or all the tests made by Jelsoft are proving that these systems are useless ?! they tend to release modifications that work perfectly, so i suppose that all these things are not... i hope to find something better than the actual but for now, none here have it... (ok, i have something myself, but i'm not releasing any work)

Chris M 06-18-2005 12:47 PM

Very nice hack idea - So far no odd looking tables or anything, and I'm getting about 5% compression :)

Satan

Martin 06-18-2005 09:44 PM

Installed using ja3's code and showing arounf 18-19% compression

womensden 06-18-2005 10:32 PM

I get a lot better compression with ja3's code as well.

womensden 06-18-2005 10:54 PM

Quote:

Originally Posted by womensden
I get a lot better compression with ja3's code as well.

Wow, I just had to change it back because it killed my banner.

Martin 06-18-2005 10:57 PM

I noticed a problem. both seem to break line breaks in posts

this

becomes

thisbecomes or this becomes

It was nice while it lasted

ShiningArcanine 06-19-2005 04:03 AM

Martin, would you give me specific instructions on how to reproduce that because I can't seem to reproduce it on my own?

Martin 06-19-2005 05:55 AM

It might be interfence with another another plugin. I didn't test everything.

I just uploaded through the plugin manager. I edited the xml file to add the other compression code and uploaded it seperately.

Martin 06-19-2005 06:05 AM

I just reuploaded and tested again and it does the same thing.

Just in case you were wondering, PHP 4.3.11 MySQL 4.0.21


All times are GMT. The time now is 04:46 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01865 seconds
  • Memory Usage 1,823KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete