your new function has

function BOLTescape($x, $reverse=true, $spaced=false) {

with $spaced=false at the end.

My existing one has:

function xBOLTescape($x, $reverse=true) {

Did you make other changes that inserted that.

I am using 3.4.14


On Tue, Sep 20, 2011 at 2:49 PM, DrunkenMonk <[email protected]> wrote:

> I have certain pages on my site that take a long time to load, in the
> order of 10 seconds.
> Changing BOLTescape to the following code reduced that by roughly a
> third:
>
> function BOLTescape($x, $reverse=true, $spaced=false) {
> ## USED IN VARIOUS PLACES TO PRESERVE SOME OUTPUT AND BLOCK ANY
> FURTHER MARKUP PROCESSING. SET REVERSE TO FALSE TO UNESCAPE A STRING
> OF TEXT.
>  static $Token = array();
>  static $c = 0;
>  if ($x == '') return;
> //  if ($x == "\n") return '<>';
>  if($reverse == false) {
>    while (preg_match('/~~([0-9]+)\*?~~/', $x) != 0) $x =
> preg_replace('/~~([0-9]+)\*?~~/e', '$Token[$1]', $x);
>    return $x;
>    }
>  $Token[++$c] = $x;
>  if ($spaced) return "~~$c*~~";
>  return "~~$c~~";
>  }
>
> $Token is defined as a global variable in other places but never used
> as far as I can see.
> It is, however, the count($Token) line that causes the majority of the
> slowdown, so $Token can remain global if this is preferred.
>
> Background:
> On a page that took 7 seconds to load, I added a BOLTstopwatch line to
> the BOLTdoMarkupTable function, and found that over 3 seconds was
> being spent on the pre - escape markup rule. Using my suggestion, this
> was reduced to 0.12 seconds.
>
> I'm going to go find the remaining 2 seconds of loading time and
> optimize them away too.
>
> --
> You received this message because you are subscribed to the Google Groups
> "BoltWire" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/boltwire?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en.

Reply via email to