vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Page Output Compression - Whitespace stripper. (https://vborg.vbsupport.ru/showthread.php?t=69787)

gwhooooey 10-19-2004 07:49 PM

Yes it did, thank you

diettalk 10-23-2004 12:03 PM

I'm having a problem when people try to "preview" a messages.. it takes out the lines between the paragraphs .. on either a new post or edit.

h75 10-23-2004 12:22 PM

Use this: ;)
https://vborg.vbsupport.ru/showpost....2&postcount=31

Just have a look in my Sourcecode http://halloo.de/forum.php

buro9 10-24-2004 10:33 PM

Thx Mickie D and Mystics for the additions, do you mind if I move them back into the first post?

I didn't realise this was nominated for HoTM and I suppose it's best to tidy up my first post ;)

turkforum 10-27-2004 03:14 AM

installed and my forum works ( i guess) much faster great hack

https://vborg.vbsupport.ru/showpost....2&postcount=31

Oblivion Knight 10-27-2004 08:25 AM

Quote:

Originally Posted by Ghostsuit
Simple and effective. Oh and anyone that has VB3 MicroStats hack installed will not be able to find

Code:

if (DB_QUERIES)
  {
    $pageendtime = microtime();

so place it before

Code:

if (DB_QUERIES)
                {
                        $ms = '';

Thats should do the job.

Actually, this is wrong.. Buro stated to add the code ABOVE this:

Code:

        $pageendtime = microtime();
Otherwise, the page loading time will be inaccurate. ;)

Tradjick 10-29-2004 04:11 PM

This hack is sooo sweet. It changed my forumhome output from 46.100 bytes to 38.770 bytes which means from 100% to 84% which is a gain of 16% in decreased size. Thanks you!

Gutspiller 10-31-2004 02:22 AM

So after all the discussion in this thread, does this hack screw up when you edit a post?

What about when you are applying a hack and it has you look for certain code? If you do a search for the code from what somebody gives you to search for, if your spaces aren't right, won't the search turn up zero results because you've removed the spacing?

msimplay 10-31-2004 08:23 AM

is there a way so formatting where [html] tag doesn't get messed up ?
maybe an if condition ?

Oblivion Knight 10-31-2004 09:23 AM

If you run a journal system, you may also want to add journal in to the $thisscriptis array.. :)

Amavisca 10-31-2004 03:57 PM

when i try to put 'journal' in, it game an error

Oblivion Knight 10-31-2004 04:02 PM

Make sure that the line above has a commar after it..

It should look something like this:

Code:

        $thisscriptis = array(
                'editpost',
                'register',
                'newreply',
                'newthread',
                'sendmessage',
                'private',
                'journal'
        );


Amavisca 10-31-2004 04:09 PM

Thnx for the quick reply ok, yep i forget the comma. I have another question if u can answer: what does this info tell u :
Page generated in 0.53191209 seconds (65.18% PHP - 34.82% MySQL) with 13 queries
DEBUG Mode OFF | GZIP ON (level 1) | 0.41 : 0.40 : 0.37 | No uncached Templates

and btw I just move to a dedicate server but the serverload and memory is very high sometimes, how can i keep it low>?

msimplay 10-31-2004 05:43 PM

isn't there a way to just exclude the html tag from the white space stripper ?

Oblivion Knight 10-31-2004 05:50 PM

Quote:

Originally Posted by Amavisca
what does this info tell u :
Page generated in 0.53191209 seconds (65.18% PHP - 34.82% MySQL) with 13 queries
DEBUG Mode OFF | GZIP ON (level 1) | 0.41 : 0.40 : 0.37 | No uncached Templates

and btw I just move to a dedicate server but the serverload and memory is very high sometimes, how can i keep it low>?

What page are those stats from, and what hacks do you have installed? The page generation time and server loads are both higher than what I'd deem as normal.


Quote:

Originally Posted by msimplay
isn't there a way to just exclude the html tag from the white space stripper ?

If you use the "lite" version; the php, code and html tags shouldn't be affected.

Deimos 10-31-2004 05:53 PM

Works ok for me, I installed it.
Definite speed improvement.

Amavisca 10-31-2004 06:42 PM

Quote:

What page are those stats from, and what hacks do you have installed? The page generation time and server loads are both higher than what I'd deem as normal.
It is from my forumhome ( which has quite a few icon image and lots forums ) and I did install the Micro Stat hax.

msimplay 10-31-2004 07:28 PM

Quote:

Originally Posted by Oblivion Knight


If you use the "lite" version; the php, code and html tags shouldn't be affected.

hmm have u tested this coz for me it did change the way it rendered the page

code and php tags are unaffected but html tag goes haywire

^^ sorry

apparently this works with it great

PHP Code:

    $thisscriptis = array(
        
'editpost',
        
'register',
        
'newreply',
        
'newthread',
        
'sendmessage'
    
);

    if (!
in_array(THIS_SCRIPT$thisscriptis))
    {
        
$patterns = array('/\>\s+\</''/^\s*/m');
        
$replace = array('> <''');
        
$vartext preg_replace($patterns$replace$vartext);
    }
    else
    {
        
$vartext preg_replace('/\>\s+\</''> <'$vartext);
    } 


Mickie D 10-31-2004 07:50 PM

@buro9 feel free to do with it what ever you wish :)

this hack is great most people want to install games and pets (and i do aswell lol) but when they use vb some more and their sites get busier they will be running to these mods.


@amavisca http://turck-mmcache.sourceforge.net/index_old.html <---- the best software for php (and to all other people you wont be able to use this unless you have ssh access or you have a nice host that will install it for ya)

buro9 11-02-2004 12:41 PM

Quote:

Originally Posted by Mickie D
@buro9 feel free to do with it what ever you wish :)

this hack is great most people want to install games and pets (and i do aswell lol) but when they use vb some more and their sites get busier they will be running to these mods.


@amavisca http://turck-mmcache.sourceforge.net/index_old.html <---- the best software for php (and to all other people you wont be able to use this unless you have ssh access or you have a nice host that will install it for ya)

First post adjusted to use the array version (simpler than explaining what is going on with a 'lite' or 'extreme' version).

Also added credit to those in this thread who have helped others resolve problems and questions from others.

Also modified the instruction to say AFTER a chunk of code, rather than BEFORE. As the old version depended on not having microstats installed... the new version should be clearer for all of those who want to install it... microstats or not.

Gutspiller 11-02-2004 04:51 PM

So if we use the lite version regular code that is edited during adding a new hack won't be affected and look different?

Is there a big difference between the lite and extreme versions as far as page loading speed is concerned?

Say, if I was interested in the fastest speed, maybe install all the hacks I ever wanted installed on my board and then as the very last hack run the extreme version of this that "compresses" all the code together, so the code looked like sheet, but at least they loaded fast?

buro9 11-02-2004 06:44 PM

No difference to any hacks... all hacks will run prior to this (except microstats), and it is the final HTML for the whole page that has whitespace stripped.

I couldn't see a difference between the old lite and extreme versions on page rendering... I suspect it's just too small to be noticeable. The only difference between those two versions is how much whitespace is left in the page... you are fine to use the lite one without anything messing up, but some of us like being a little too anal and stripping as much as we safely can even when the difference is arguable... "if it doesn't cost anything, then do it" is my philosophy.

Yup, that last line describes what it does. But I've only this evening updated the hack (see the first post)... so there isn't a seperation between lite and extreme. It runs the and the extreme stuff where it can, and the lite stuff everywhere else.

Erwin 11-03-2004 03:50 AM

I've installed this and it seems to work well. Good idea.

Natch 11-04-2004 12:40 AM

^ ^ ^ The ultimate test ;)

h75 11-06-2004 05:06 AM

I had this modification enhanced. Because I work on calendar :rolleyes:

Code:

// ###################### Page Output Compression #######################

        $thisscriptis = array(

            'editpost',
            'register',
            'newreply',
            'newthread',
            'sendmessage',
            'calendar',
            'faq',
            'profile',

            'private',
        );

        if (!in_array(THIS_SCRIPT, $thisscriptis))
        {
    $patterns = array('/\>\s+\</', '/^\s*/m');
    $replace = array('> <', '');
    $vartext = preg_replace($patterns, $replace, $vartext);
        }
        else
        {
            $vartext = preg_replace('/\>\s+\</', '> <', $vartext);
        }

// ###################### Page Output Compression #######################


Mijae 11-09-2004 08:09 PM

Works for me!

I turned gzip to 1, applied this hack, and my forums are loading so fast I cant believe it.

MickDoneDee 11-17-2004 09:59 PM

*installed* Simple installation and great results.

I already had VB3 MicroStats installed so I added the code BEFORE:

$pageendtime = microtime();

Results:

Code:

Page generated in 0.13810205 with hack    0.32 : 0.24 : 0.19  index.php
Page generated in 0.13857198 without hack 0.15 : 0.29 : 0.23

Page generated in 0.23258996 with hack    0.23 : 0.23 : 0.18  England forumdisplay
Page generated in 0.23134303 without hack 0.55 : 0.31 : 0.22

Page generated in 0.45348811 with hack    0.08 : 0.19 : 0.17  showthread - The 1981 Ashes series revisited
Page generated in 0.45551610 without hack 0.53 : 0.37 : 0.25

As you can see there's not a lot of difference in the speed that the pages are generated but there is a significant reduction in average server load.

I have a broadband connection and the increased download speed is only marginally apparent. According to Speedar my connection speed is approx. 104.2 kilobytes/sec.

I also did a gzip test which produced the following result for my homepage:

The webpage is COMPRESSED / GZIPPED!

>> Savings: 80%

Filesize: 55.6KB [11.2KB] html / text only

MickDoneDee 11-18-2004 10:17 AM

Sorry, I had to uninstall this because I need to use Code tags occasionally to display tables properly and this hack causes tables to display incorrectly. Pity a solution can't be found for this otherwise it is a great hack.

Is there a version that doesn't alter the spaces within Code, PHP and Pre tags?

buro9 11-19-2004 12:15 PM

Quote:

Originally Posted by MickDoneDee
Is there a version that doesn't alter the spaces within Code, PHP and Pre tags?

No.

It could theorhetically be done, but the additional overhead in doing so would hurt you in performance.

I'd need to regexp for <pre> and </pre>, chop those out, perform the strip, and put those backin... string concats and chops of that size is far more intensive than simply the current regexp for the strip.

Would people really want a solution that was heavier on the processing?

MickDoneDee 11-19-2004 12:57 PM

Hi buro9, I can live without the pre tags but I do need to use the code tags to display tables properly. Is that possible? Or does the code tags present the same problems as the pre tags?

buro9 11-19-2004 01:22 PM

Quote:

Originally Posted by MickDoneDee
Hi buro9, I can live without the pre tags but I do need to use the code tags to display tables properly. Is that possible? Or does the code tags present the same problems as the pre tags?

Precisely the same problem.

Doable... but then it's more intensive and I personally wouldn't want have added something intensive to every page.

Robert9 11-20-2004 09:10 AM

yo,yo. Nice idea, but why dont improve the code itself. If i watch the code of templates there is about 30% to save i think. Nobody needs things like

cellpadding="0" if cellpadding=0 do the same; for a lot of other parts it goes the same ...

Natch 11-20-2004 11:12 AM

Quote:

Originally Posted by Robert9
yo,yo. Nice idea, but why dont improve the code itself. If i watch the code of templates there is about 30% to save i think. Nobody needs things like

cellpadding="0" if cellpadding=0 do the same; for a lot of other parts it goes the same ...

Not exactly true: cellpadding=0 is not valid, cellpadding='0' and cellpadding="0" are the same, but cellpadding=0 is not...

Example, <img src=image name.jpg alt=an image on my webpage border=0> << very bad...

buro9 11-21-2004 06:39 AM

Yup, because for it to be XHTML valid, all attributes MUST be quoted regardless of datatype of value (i.e. even if it is a number, or a string without spaces, it still needs quoting).

And of course, feel free to modify all of your code, and then you will see why vBulletin left some pieces of styling and spacing within HTML and not CSS... compatibility for CSS is still shakey for those not using the very latest browsers (still shakey for some that are using the latest browsers).

blueuniverse 11-23-2004 07:00 PM

Am I missing something, as you've mentioned both lite and extreme versions? I only see one at the beginning of the thread, is this the lite version? I've probably missed something and looked like a fool, lol :p

blueuniverse 11-27-2004 06:55 PM

Anybody??? Am I doomed to suffer from slow loading times and bloated bandwidth usage forever. Noooooooo

Paul M 11-27-2004 07:01 PM

Quote:

Originally Posted by blueuniverse
Anybody??? Am I doomed to suffer from slow loading times and bloated bandwidth usage forever. Noooooooo

Use the version in post 65. :)

blueuniverse 11-27-2004 07:21 PM

what exactly does that do though in comparison to the other one?

Paul M 11-27-2004 11:26 PM

Which other one ?

That is basically the final version that people came up with - it uses the more agressive stripping except for the listed scripts, where it uses the 'lite' version.

NightWalk8r 11-27-2004 11:42 PM

Kick a$$!!!!!!
great hack =)


All times are GMT. The time now is 02:50 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.01555 seconds
  • Memory Usage 1,837KB
  • 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
  • (6)bbcode_code_printable
  • (1)bbcode_php_printable
  • (10)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