View Full Version : Template Compressor
VBCoder
07-07-2005, 02:58 AM
PROBLEM: Pages are produced with huge amounts of white space, comments, etc., bloating the HTML, load time, and bandwidth.
SOLUTION: Compress it. Remove whitespace, etc.
PROBLEM: This takes CPU time.
SOLUTION: Precompress the templates. That is, store two copies of each template. A "master", which is showed when you edit, and a "compressed", which is generated each time you save a new template (or edit one), without whitespace and comments. The compressed one is actually used.
Anyone up to the challenge?
Biker_GA
07-07-2005, 03:06 AM
https://vborg.vbsupport.ru/showthread.php?t=83248 ;)
Dream
07-07-2005, 03:10 AM
the same template content is stored in two columns, not sure why, one is used in eval() I think, you could compress that one I think
Biker_GA
07-07-2005, 03:13 AM
With compression -
Powered by vBulletin Version 3.5.0 Beta 3
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
[Output: 25.91 Kb. compressed to 24.95 Kb. by saving 0.96 Kb. (3.69%)]
Page generated in 0.09913 seconds with 8 queries [Server Loads: average: 0.50, 0.81, 0.85 0.50 : 0.81]
Without compression -
Powered by vBulletin Version 3.5.0 Beta 3
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Page generated in 0.09982 seconds with 8 queries [Server Loads: average: 0.61, 0.74, 0.81 0.61 : 0.74]
VBCoder
07-07-2005, 03:35 AM
Biker, I saw that plug in, but it compresses each page as it is served. As I said, this could be further optimized by just compressing the template. See PROBLE #2.
(I have in mind some additional compressions, that would take more time, and hence are best done only once).
Biker_GA
07-07-2005, 03:39 AM
Biker, I saw that plug in, but it compresses each page as it is served. As I said, this could be further optimized by just compressing the template. See PROBLE #2.
(I have in mind some additional compressions, that would take more time, and hence are best done only once).
You may wish to read the hack again. It is a template compressor. Not a page compressor.
Andreas
07-07-2005, 03:43 AM
the same template content is stored in two columns, not sure why, one is used in eval() I think, you could compress that one I think
Performance :)
PHP obviously doesn't understand <if> ... <else />, <phrase>.
So this has to be parsed into native PHP Calls, and if this would be done for every Template upon every Page Call it would be a mjaor performance hit.
Compressing the Templates Offline is a good idea, unfortunately there a a bunch of Problems - JavaScript for example.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.