Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#11 2009-07-26 17:50:13
- ruud
- Developer emeritus
- From: a galaxy far far away
- Registered: 2006-06-04
- Posts: 5,068
- Website
Re: pat_speeder
You can partially solve the PRE thing, by doing this (doesn’t catch CSS-based pre formatted styles):
function pat_speeder($buffer)
{
if (FALSE === strpos($buffer, '<pre'))
{
$buffer = preg_replace('/\s+/', ' ', $buffer);
}
return $buffer;
}
Offline
#12 2009-07-26 18:12:51
- ruud
- Developer emeritus
- From: a galaxy far far away
- Registered: 2006-06-04
- Posts: 5,068
- Website
Re: pat_speeder
I did some testing:
Without compression:
before: 22794
after: 22,314 (2.1% reduction due to plugin)
With compression:
before: 7989 [compressing gives a 65% reduction!]
after: 7842 (1.8% reduction due to plugin)
Not sure if this breaks anything. It assumes that whitespace surrounding tags is pointless.
$buffer = preg_replace('/\s+/', ' ', $buffer);
$buffer = str_replace(array(' <', '> '), array('<', '>'), $buffer);
normal: 21955 (3.7% reduction)
compressed: 7789 (2.5% reduction)
Add comment removal (which was commented out, probably because it doesn’t properly handle all valid comments, but it works for simple comments):
$buffer = preg_replace('/\s+/', ' ', $buffer);
$buffer = str_replace(array(' <', '> '), array('<', '>'), $buffer);
$buffer = preg_replace('/<!--.*?-->/', '', $buffer);
normal: 21415 (6.0% reduction)
compressed: 7563 (5.3% reduction)
Offline
#13 2009-07-26 18:55:28
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,453
- Website
Re: pat_speeder
Ah Ah. So it’s yours now.
What a great demonstration! Thx lot.
Ok. If Ruud is all right, I’ve just updated to version 0.2 which include this help (infos and history into the plugin updated too).
Best regards, Ruud.
P.S. When do you come back in the Team, man?
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#14 2009-07-26 21:27:07
- ruud
- Developer emeritus
- From: a galaxy far far away
- Registered: 2006-06-04
- Posts: 5,068
- Website
Re: pat_speeder
Noooo, not mine. Just playing with it ;)
I have no plans for getting back in the team.
Offline
#15 2009-07-27 12:18:44
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: pat_speeder
Patrick
Nice adds to the plugin.
Ruud
Thanks for posting some stats. I take it that’s the page size (byte) reduction you are posting?
— Steve
Offline
#16 2009-07-27 12:46:42
- ruud
- Developer emeritus
- From: a galaxy far far away
- Registered: 2006-06-04
- Posts: 5,068
- Website
Re: pat_speeder
Yes, it’s the page size. Note that actual reduction will vary with how you’ve written your templates, but you do get some idea of how effective it is. Basically if you’re not using gzip/deflate compression yet, that should be the first thing you do to reduce traffic, before using a plugin like this one.
Offline
#17 2009-07-27 18:54:28
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,453
- Website
Re: pat_speeder
[ post deleted on Ruud’s demand ]
Last edited by Pat64 (2009-07-27 20:17:00)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#18 2009-07-27 19:58:30
- ruud
- Developer emeritus
- From: a galaxy far far away
- Registered: 2006-06-04
- Posts: 5,068
- Website
Re: pat_speeder
Please don’t release it using my author prefix. If you must, rename it to pat_something.
It’s been suggested before to add such compression to rvm_css, but I don’t think it’s worth the trouble.- the browser caches the style sheet, so it doesn’t get loaded on every page hit.
- after gzip/deflate compression there’s very little left to compress.
- I prefer to keep the style sheet readable, even for visitors.
- if you look at most websites, serving CSS takes up very little of the total bandwidth used. Shaving very little of very little results in a very very small reduction.
- it might break certain CSS hacks.
- adding a copyright comment after first removing all comments seems counter-productive.
Offline
#19 2009-07-27 20:18:26
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,453
- Website
Re: pat_speeder
Ok. The post had been deleted.
Best regards,
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#20 2009-07-28 13:52:34
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,453
- Website
Re: pat_speeder
Sorry for the number of realizes. I try to make my best to have a (very) good work ;)
Please refer to the first post for download . And don’t forget to delete/replace your obsolete version from your back-office.
Best regards,
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline