Recent Topics

1 Jan 21, 2010 08:46    

My b2evolution Version: 3.3.3

Hi,

I just had an idea for possible improvement of performance of b2evolution loading (especially, the first visit).

I noticed that many CSS files are involved (I used the webpagetest dot org service) to render my home page: around 10 files. Even though each file is quickly loaded, it takes about 200ms for each file (the RTT between client and server) which results in overall 2 seconds delay just because of CSS files (add 4 more for javascript files...).

I am wondering if a kind of dynamic caching with php would be possible: the page would just reference one stylesheet "css.php" file (with eventually the session information as GET parameter). That css.php script would return the appropriate mime type for CSS. Then, it would simply open the referenced CSS files (through a http connection, so that even server-processed stylesheets are rendered correctly, but since we are localy accessing the files, it is fast) and echo their contents.

It could even do funky things such as removing spaces, comments, and so on...

I am not sure the impact of this on caching.

Finally my question: is this a stupid idea? Why? ^^

Thanks for reading!

2 Jan 21, 2010 09:14

It's actually a good idea.

Moved to feature requests forum

4 Jan 29, 2010 00:51

I would leave this at least configurable, because I believe many hosts transparently compress the CSS using apache's mod_deflate. Anyway, I don't know which is more efficient / resource friendly between mod_deflate or php.

As I wrote, if we have this CSS proxy in place, we can do a lot of fancy stuff with the output, such as removing comments, spaces, compression...

BTW, I have no precise idea about how to achieve the feature, but it would be even nicer if we can use the same architecture to proxy the javascript files also :)

I don't think something can be done about pictures (merge all the pictures into one big file, and use CSS sprites... sounds too complex for automatic processing to me...)

Well, I hope someone gets motivated to implement this :) If it is generic enough, I am sure it can even be useful to projects others that b2evolution...

5 Jan 30, 2010 10:26

even nicer if we can use the same architecture to proxy the javascript files also

Since b2evo version 3, javascript are compressed using minify or something like that. It was a great upgrade.

I don't think something can be done about pictures (merge all the pictures into one big file, and use CSS sprites... sounds too complex for automatic processing to me...)

It could be done for skins:
- online css script generator: http://spritegen.website-performance.org/
- offline css script generator: https://launchpad.net/css-sprite-generator

I will try it for evopress skin.

6 Jan 30, 2010 10:57

Oh, OK, thank you for the details, I did not know about these. Anyway, I was more referring to "on-the-fly" type of processing, which would allow more flexibility I believe...


Form is loading...