@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Optimize matching regexps in Herald rules

Summary:
We spend 6.37 s in this condition on a big diff.
By adding the 'S' flag, the time is down to 2.15 s.

Test Plan: `DifferentialRevisionEditor::newRevisionFromConduitWithDiff()`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3284

vrana ea0fe6d6 012370c6

+4 -1
+4 -1
src/applications/herald/engine/HeraldEngine.php
··· 350 350 break; 351 351 case HeraldConditionConfig::CONDITION_REGEXP: 352 352 foreach ((array)$object_value as $value) { 353 - $result = @preg_match($test_value, $value); 353 + // We add the 'S' flag because we use the regexp multiple times. 354 + // It shouldn't cause any troubles if the flag is already there 355 + // - /.*/S is evaluated same as /.*/SS. 356 + $result = @preg_match($test_value . 'S', $value); 354 357 if ($result === false) { 355 358 $transcript->setNote( 356 359 "Regular expression is not valid!");