11
rabideau
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 3:50

  • rabideau

  • Home away from home

  • Posts: 1042

  • Since: 2003/4/25


I just ran a test on this assumption (about unwanted spaces slowing a site down). Turns out that this assumptions seems to be untrue for my style.css anyway.

The results of my tests are posted here:
http://helpxoops.info/modules/newbbex/viewtopic.php?topic_id=49&post_id=253&order=0&viewmode=flat&pid=0&forum=14#forumpost253

I find it curious...
Pax vobiscum,
...mark

may the road rise to meet your feet!

http://treemagic.org

12
snow77
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 4:02

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


I have known that stripping HTML code from all &nbsp; and <br /> is the optimal way, but putting all CSS styles under one line I had never heard of this before. It can be that it makes it faster, but for me it's much much easier to read and write all the code lines in HTML and CSS with all the indents it has, specially HTML.
www.polymorphee.com
www.xoopsdesign.com

13
wizanda
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 9:05

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Out of my own experimentation Kernal module.php = 64 kb to begin with, after Wizanda compression = 47kb


As for all files and online compressors, I don’t like them and not my plan for Xoops.

See if I can find some before and after shots:
Newbb_menu_click CSS 436 bytes
div.dropdown .menudiv.dropdown .userbar {
  
positionabsolute;
  
left0px;
  
top2px;
  
visibilityhidden;
}

div.dropdown .userbar .item{
  
padding2px 5px;
}

div.dropdown .menubar{
    
floatleft;
    
padding5px 10px;
    
margin0px 1px;
    
font-weightbold;
}

div.dropdown a.item {
      
displayblock;
}

Newbb_menu_click CSS 328 bytes
div.dropdown ul {display:block;margin:0px;padding:0px;border:0px;list-style:none;}
div.dropdown li {display:block;margin:0px;border:0px;position:relative;padding1px 0px;z-index:9;list-style:none;cursorpointer;}
div.dropdown li:hover {z-index:10;}
div.dropdown li ul {positionabsolute;displaynone;left: -30px;top16px;}
div.dropdown li>ul left: -1px;}
div.dropdown ul {z-index:1}
div.dropdown li:hover ul{display:block;}

For me 1 that is easier to see the whole content in an editor, and 2 reduces read speed, without making scrabbled eggs!
Ok now JS files:
newbb_menu_click js 1.39 Kb
function openMenu(eventid) {

  var 
elxy;

  
el document.getElementById(id);
  if (
window.event) {
    
window.event.clientX document.documentElement.scrollLeft
                             
document.body.scrollLeft;
    
window.event.clientY document.documentElement.scrollTop +
                             + 
document.body.scrollTop;
  }
  else {
    
event.clientX window.scrollX;
    
event.clientY window.scrollY;
  }
  
-= 2-= 2;
  
el.style.left "px";
  
el.style.top  "px";
  
el.style.visibility "visible";
}

function 
closeMenu(event) {

  var 
currentrelated;

  if (
window.event) {
    
current this;
    
related window.event.toElement;
  }
  else {
    
current event.currentTarget;
    
related event.relatedTarget;
  }

  if (
current != related && !contains(currentrelated))
    
current.style.visibility "hidden";
}

function 
contains(ab) {

  
// Return true if node a contains node b.

  
while (b.parentNode)
    if ((
b.parentNode) == a)
      return 
true;
  return 
false;
}


newbb_menu_click JS 1.21 Kb
function openMenu(eventid) {var elxy;
el document.getElementById(id);
if (
window.event) {
window.event.clientX document.documentElement.scrollLeft
document.body.scrollLeft;
window.event.clientY document.documentElement.scrollTop +
document.body.scrollTop;}
else {
event.clientX window.scrollX;
event.clientY window.scrollY;}
-= 2-= 2;
el.style.left "px";
el.style.top  "px";
el.style.visibility "visible";}
function 
closeMenu(event) {
var 
currentrelated;
if (
window.event) {current this;
related window.event.toElement;}
else {
current event.currentTarget;
related event.relatedTarget;}
if (
current != related && !contains(currentrelated))
current.style.visibility "hidden";}
function 
contains(ab) {
// Return true if node a contains node b.
while (b.parentNode)
if ((
b.parentNode) == a)
return 
true;
return 
false;}


Again making for easier reading by us and the browser and servers, without making scrabbled egg.

Oh by the way this is also about the whole of the web not just Xoops, may do Smarty next


For PHP files I was going to include some examples, yet they take up loads more room and basically the same things need doing as has with JavaScript.
Spaces need removing{}
Brackets don’t need to be on another line
{
For 
something contained here
}
{
it can contain like thatso it is next to that item
}
{or 
Closing items around them self’s like we do in PHP normally to read}

When we include messages for others to follow, this is code and so space is needed not free.
So shortening all of these reduces our file size and so read speed.
/**** This title for item
* This parram
* This array */

Unsure if when escaped any part of a document, it still pause as reading, like on disclaimers in all files, I would imagine there is processing to say ignore it.
So maybe a full Documentation would be better included with the package, as anyone can still copy it regardless if we have a big heavy open source license in each file, that makes the overall file size larger.
Not that I have removed the XOOPS information, its just an idea for small faster Xoops.

14
wizanda
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 11:02

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Php Example:

Article/class/article.php = 54 kb = 1522 lines

After Removing space = 45 kb = 1003 lines


=

15
rabideau
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 13:57

  • rabideau

  • Home away from home

  • Posts: 1042

  • Since: 2003/4/25


The only point I wanted to make is that the compression of a css file might save a tad of disk space... but seems to have zero postive impact in performance (actually my tests indicate it runs less efficiently). Truth of the matter is that css is so far away from machine code that it is impossible to guess why this might be.

The bottom line for me is I like css I can read easily. And it seems we suffer no performance degradation as a result.
Pax vobiscum,
...mark

may the road rise to meet your feet!

http://treemagic.org

16
wizanda
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 14:11

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Before attempting anything, i normally do quite a bit of research and test it...so again CSS, and JS compression systems, don't work well.

Yet compressing files does, proof is in pudding and only did CSS on Newbb to improve speed.

Now my main concern is PHP, which we have tons of extra lines of space which delay reading, which is noticeable clearly when removed.

As does the CSS, and JS as I tested before posting, not sure if you mash it up through one of them system, yet me personally as a web developer have already done most of our site and improvement in all file types is noticeable, anyways hopefully these will be next releases

17
rabideau
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 14:43

  • rabideau

  • Home away from home

  • Posts: 1042

  • Since: 2003/4/25


Hi Wiz.

The real problem is that most everything in XOOPS involves using interpretive not compiled languages. Interpretive languages are by default efficient in generation not operation.

Certainly there are correct and/or better ways to write code (compiled, interpretive or otherwise). To that end I think a guide on good XOOPS techniques and tricks is most useful.

I only ran my test because you piqued my interest. I found the results curious and counter-intuitive. That's why I shared them
Pax vobiscum,
...mark

may the road rise to meet your feet!

http://treemagic.org

18
wizanda
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/3/17 15:01

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Thxz nice of you to explain....

The reason being is as I found before starting this, after seeing combine.php whose site runs really fast, started me thinking about compression.
Yet with most developers comments i found about them stripping systems, they also take out to much code.
So why your results, when you do a higher level that allows it to strip it, as it feels.
Now all code is different and them systems take it to be the same and so make more mistakes, the higher the level.
What i am meaning is for the whole of Xoops; is lets by hand lower file sizes, reduce all code reading and increase XOOPS speed loads through it, as i am already seeing, each time i fix any modules PHP with spaces.

All i am doing really is if it
{ -->

<-- }

<--

So all items are just going on the line above or below, depending which way it needs closing.

so unlike a computerized system, there are not mistakes (well except me over clicking delete)

So then I have stripped code, it’ the same code, your isn't the same code and why the problem.
I would never suggest using automated systems, it is like trying to fix your pc with the countless repair systems there are, they mess up your registry not fix it.

Anyways, going to get finished, with 2.25rc2 kernel now, see how much of a difference that makes, done parts and made a huge difference already.

19
wizanda
Re: Stripping Xoops of unwanted Spaces, will increase speed
  • 2007/10/12 18:49

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Well that is Xoops 2.2.5z files all stripped....
The MySql optimization still needs adding also....

Login

Who's Online

80 user(s) are online (56 user(s) are browsing Support Forums)


Members: 0


Guests: 80


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits