Inside the censorString there is a fast-path check to return early if there are no censoring to apply and thus avoid the preg_replace call.
However, it appears that the line:
Will be called when $censorCache has no contents in some cases, which I observed using xdebug trying to track down why a thread was taking considerable time to render.
It also appears that this preg_replace call is not a no-op when passed a zero length array as it was taking a ~10% of the execution time for rendering a thread
However, it appears that the line:
PHP:
$string = preg_replace(array_keys($censorCache), $censorCache, $string);
Will be called when $censorCache has no contents in some cases, which I observed using xdebug trying to track down why a thread was taking considerable time to render.
It also appears that this preg_replace call is not a no-op when passed a zero length array as it was taking a ~10% of the execution time for rendering a thread