-
-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Description
I noticed something in the endsInKeyword function that I think is causing a large performance hit when processing large amounts of Javascript.
The check does a preg_match on the full output in order to see if it is ending with certain keywords. However, as that output grows this check takes longer and longer to run.
Would it not be better to limit the amount of output matched to something reasonable? For instance, I changed:
$testOutput = $this->output . $this->a;
to
$testOutput = substr($this->output . $this->a, -50);
and processing time for my experiment dropped from over a minute to a second or two. No change in the Javascript produced (though I am not entirely sure what condition this function is used for).