Fast reply!

Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here.
Forum rules
Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here. Feature requests are closed.
User avatar
Nicholas the Italian
Registered User
Posts: 659
Joined: Mon Nov 20, 2006 11:19 pm
Location: 46°8' N, 12°13' E
Contact:

Re: OT (at least a tangent): phpbb3, prosilver/subsilver perform

Post by Nicholas the Italian »

Acyd Burn wrote:Of course subsilver2 is a lot faster - due to the extensive usage of CSS in prosilver. :) The data is a lot larger for prosilver, ~64KiB of CSS alone, not to mention the amount of images.
Giving a quick look at css files, I see that some 10% of the total is whitespace, and about 15% are comments. I didn't look deep to see if there are other ways to reduce size, like putting definitions together or using shorter (while still sensical) names, but maybe there's room for some optimization?
PS: I'm looking at RC1 files, don't know about later versions.

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: Fast reply!

Post by code reader »

Nicholas the Italian wrote:I see that some 10% of the total is whitespace, and about 15% are comments.
are those numbers real, or just estimates?
would be interesting to see real numbers.

getting rid of whitespace end comments is usually not a good idea.
however, what get sent to the browser is not the file itself: the browser pulls "style.php", which process the actual source, stores a copy in the DB or the file system, and then sends it down.
it should not be that difficult to get style.php to do some rudimentary compression, such as compressing white spaces and eliminating comments.
if indeed spaces and comments take as much as NTI says, this might help both speed and bandwidth.
just a thought...

User avatar
Nicholas the Italian
Registered User
Posts: 659
Joined: Mon Nov 20, 2006 11:19 pm
Location: 46°8' N, 12°13' E
Contact:

Re: Fast reply!

Post by Nicholas the Italian »

Here's a few statistics about biggest files.

Code: Select all

File name                   colours.css
Lines                       957
Non-empty lines             754
Characters                  18647
Characters without blanks   17059
Commented char count        3588
Commented char percent      19,2

File name                   content.css
Lines                       746
Non-empty lines             631
Characters                  11118
Characters without blanks   9822
Commented char count        1343
Commented char percent      12,1

File name                   common.css
Lines                       622
Non-empty lines             519
Characters                  9534
Characters without blanks   8427
Commented char count        1524
Commented char percent      16

File name                   buttons.css
Lines                       192
Non-empty lines             163
Characters                  6679
Characters without blanks   5947
Commented char count        859
Commented char percent      12,9

File name                   cp.css
Lines                       425
Non-empty lines             346
Characters                  6434
Characters without blanks   5734
Commented char count        723
Commented char percent      11,2

File name                   forms.css
Lines                       371
Non-empty lines             305
Characters                  5535
Characters without blanks   4947
Commented char count        869
Commented char percent      15,7
If I enter in the address bar http://forum.mysite.it/style.php?sid=...&id=...&lang=... I get the whole 66KB stylesheet, with whitespaces and comments and the following statistics:

Code: Select all

Lines                       3583
Non-empty lines             2942
Characters                  63962
Characters without blanks   57271
Commented char count        10257
Commented char percent      16
So, we could get below 50KB, at the very least.

RC1, I repeat.

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: Fast reply!

Post by code reader »

if you are up for some experimentations, you might want to look here:
http://www.roscripts.com/Compress_CSS_code-99.html

User avatar
Nicholas the Italian
Registered User
Posts: 659
Joined: Mon Nov 20, 2006 11:19 pm
Location: 46°8' N, 12°13' E
Contact:

Re: Fast reply!

Post by Nicholas the Italian »

Syntetically:

Code: Select all

function compress($buffer)
{
  // remove comments  
  $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);  
  // remove tabs, spaces, newlines, etc.  
  $buffer = str_replace(array("\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);  
  return $buffer;  
}   
Another doubt I'm having.
Since the SID is included as a parameter for search.php, and it changes everytime, is the entire stylesheet re-downloaded at every visit at the forum?

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: Fast reply!

Post by code reader »

code reader wrote:Since the SID is included as a parameter for search.php, and it changes everytime...
it is my understanding that the SID changes once per session, not "every time". of course, i may be wrong here...
you may want to test it, eg., by adding a load-counter to, say, common.php and style.php, so you can see if they are really equal.

User avatar
Nicholas the Italian
Registered User
Posts: 659
Joined: Mon Nov 20, 2006 11:19 pm
Location: 46°8' N, 12°13' E
Contact:

Re: Fast reply!

Post by Nicholas the Italian »

code reader wrote:it is my understanding that the SID changes once per session, not "every time"
Every time = at every new visit.
Of course I don't have to reload the css for each page, but I may have for each visit, which is still a waste of bandwidth and time.
Did not test actually, but it actually looks like it hangs a little before loading images and everything, each time - might be just an impression though.

Post Reply