Use a fixed regex for StripState
authorTim Starling <tstarling@wikimedia.org>
Sat, 18 Oct 2014 22:31:27 +0000 (15:31 -0700)
committerOri Livneh <ori@wikimedia.org>
Sun, 19 Oct 2014 21:38:09 +0000 (14:38 -0700)
commit6da3f169ac55ae87837a4ba3cf3e30f83fbf9d7d
tree974943ec7c011eccfe83749b6fb9c2c1e7d48555
parent5950ac2cef80cd69306458672adb4755fab60e98
Use a fixed regex for StripState

The JIT compiler in newer versions of PCRE experiences lock contention
when multithreaded applications perform a high rate of concurrent
compilations. We are seeing some performance impact on HHVM under normal
production traffic.

The random part of the strip marker is just there to protect against
deliberate insertion of strip markers into the source text, which is
very rare. So use a generic regex to find strip markers, and check in
the callback whether the random state ID is correct.

StripState::killMarkers() will be slower when it has to remove many
strip markers, but most calls to it will not match any strip markers, so
overall performance should be improved due to reduced JIT compilation.

Bug: 72205
Change-Id: I8d37ae929a8c669c9e39adc8096b89e5732b68d0
includes/parser/Parser.php
includes/parser/StripState.php