vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Does white space hurt (https://vborg.vbsupport.ru/showthread.php?t=303717)

K4GAP 10-22-2013 04:52 PM

Does white space hurt
 
I've noticed in the code (any vb code) there are sometimes spaces between lines of code. Does that have any adverse effect on load time?

Is there a reason for what I call white space?

Would it hurt anything if I closed up all the code so there was no "white space"?

squidsk 10-22-2013 07:40 PM

Quote:

Originally Posted by GaryT (Post 2455362)
I've noticed in the code (any vb code) there are sometimes spaces between lines of code. Does that have any adverse effect on load time?

Is there a reason for what I call white space?

Would it hurt anything if I closed up all the code so there was no "white space"?

White space in php has no bearing on load time, due to the fact that the php is run server side and ignores whitespace. Long story short there's no benefit to removing whitespace from php but there is a downside, which is that if you ever need to find something in the code it becomes significantly more difficult to do so since it is no longer readable.

As an aside, javascript and css there's a benefit to having minimal whitespace, which is why vbulletin css (and js I believe) by default comes minified because it saves you bandwidth to send a file with minimal size.

K4GAP 10-30-2013 03:50 AM

Quote:

Originally Posted by squidsk (Post 2455387)
White space in php has no bearing on load time, due to the fact that the php is run server side and ignores whitespace. Long story short there's no benefit to removing whitespace from php but there is a downside, which is that if you ever need to find something in the code it becomes significantly more difficult to do so since it is no longer readable.

As an aside, javascript and css there's a benefit to having minimal whitespace, which is why vbulletin css (and js I believe) by default comes minified because it saves you bandwidth to send a file with minimal size.

Thanks for the explanation.

Digital Jedi 10-30-2013 06:16 AM

Just to clarify further, in code white space is not the line breaks, which is what I think you were referring to specifically. White space is anywhere the space bar was pressed. So minified CSS and JavaScript remove white space, new lines and tabs from the code and compresses it down to practically unreadable code. But it does save some resources. However, if you were thinking of just removing space and lines inside templates, then the effect on page load would be negligible and make it harder to read (and upgrade).


All times are GMT. The time now is 06:40 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.01525 seconds
  • Memory Usage 1,717KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete