Codice PHP:
function custom_preg_match($pattern$subject, &$matches) {
  
$debug false// metti a true per provare la differenza
  
if ($debug) return ($matches);
  return (
preg_match('#<span class="test1">(.+?)</span>#s'$cont$m));
};

// preg_match('#<span class="test1">(.+?)</span>#s', $cont, $m) diventa:
custom_preg_match('#<span class="test1">(.+?)</span>#s'$cont$m); 
in pratica i preg_match li cambi in modo che chiamino una tua funzione che normalmente fa la stessa cosa... però puoi "bypassare" le chiamate restituendo un valore "di comodo" saltando il pattern matching per vedere la differenza in termini di tempo