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)

buro9 09-22-2004 10:00 PM

Page Output Compression - Whitespace stripper.
 
No longer supported by the author.

nexialys 09-23-2004 04:11 PM

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...

buro9 09-23-2004 04:18 PM

Quote:

Originally Posted by nexialys
this have been done in another hack related to templates compression...

I did search, maybe you could point to where this is.

Quote:

Originally Posted by nexialys
most of the time, it's not good to have such a feature because html is not written well, or is not xhtml relevent...

The hack doesn't break things, it doesn't affect JavaScript, etc... it merely collapses white space.

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.

Red Blaze 09-23-2004 08:14 PM

I'm using 3.0.0, and I had to do something else, and still worked.

You see, I didn't find:

PHP Code:

if (DB_QUERIES
  { 

But I did find:

PHP Code:

    $pageendtime microtime(); 

I just put:

PHP Code:

$patterns = array('/\>\s+\</''/^\s*/m'); 
    
$replace = array('> <'''); 
    
$vartext preg_replace($patterns$replace$vartext); 

AFTER what I had to find and it works just as you said. Now my forums are running faster. ^^;;

buro9 09-23-2004 08:48 PM

Quote:

Originally Posted by Sonikku
I'm using 3.0.0, and I had to do something else, and still worked.

You see, I didn't find:

PHP Code:

if (DB_QUERIES
  { 

But I did find:

PHP Code:

    $pageendtime microtime(); 


Strange indeed.

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.

buro9 09-23-2004 08:49 PM

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 :)

58sniper 09-23-2004 09:13 PM

That won't work if someone uses the <pre> tag, which utilizes whitespace for formatting.

buro9 09-23-2004 10:24 PM

Quote:

Originally Posted by 58sniper
That won't work if someone uses the <pre> tag, which utilizes whitespace for formatting.

A fine point... added a 'lite' version to the first post that leaves white space at the beginning of lines alone.

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 ;)

Ghostsuit 09-24-2004 01:40 AM

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.

mrboz 09-25-2004 10:17 PM

wow - this makes every page load much faster

thanks very much, great hack.


All times are GMT. The time now is 02:02 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
  • Page Generation 0.01261 seconds
  • Memory Usage 1,745KB
  • 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
  • (5)bbcode_php_printable
  • (4)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
  • (10)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