Re: [SMARTY-DEV] Suggestion for the outputfilter.trimwhitespace.php plugin
| From: | Bharat Mediratta | Date: | Sat, 03 Jan 2004 04:56:32 +0000 |
| Subject: | Re: [SMARTY-DEV] Suggestion for the outputfilter.trimwhitespace.php plugin | ||
| References: | 1 2 3 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2016@lists.php.net to get a copy of this message | ||
From: "Gerard Samuel" <php-smarty@trini0.org>
...
> On Friday 02 January 2004 05:08 am, messju mohr wrote:
> > the count()-call is in the initialization of the for-loop:
> > for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
> > (note: it's a comma after "$_i=0" - not a semicolon)
> >
> > so count() is only called once right now.
>
> Right you are. So I've modified my code to reflect this.
> Now it only tests for content in the $replace array, and it just returns
when
> its empty.
Hi, Gerard. This is a pure optimization, right? In those cases,
it'd be useful if you'd include some benchmark code and some simple
performance results so that we'd get an idea the performance gain.
Typically, optimizing a decent algorithm leads to less maintainable
code so it's nice for the maintainers to see exactly what they're
getting for the cost.
-Bharat