note 4652 deleted from function.str-replace by didou

From: Date: Sat, 16 Aug 2003 09:55:02 +0000
Subject: note 4652 deleted from function.str-replace by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54322@lists.php.net to get a copy of this message
Note Submitter: paul_kroll@hotmail.com ---- Benchmarking using PHP 3.0.15, preg_replace vs. str_replace. str_replace is about 25% faster on a single match in a short string, and gets increasingly faster as the number of matches increases. (It hits 38% on the second match...) Whole-script times for 10000 matches in a loop only showed 14% differences in runtime: if you're running a script that does ONE match as a test, you'll see absolutely no difference in runtime. If you're doing a lot of matching, or if your server is heavily loaded, every little bit helps... and as a side note, doing case-insensitive preg_replace appears to be within 5% of case-sensitive preg_replace. (Case insensitive searching is almost always slower than case sensitive, it's just "by how much.")

« previous php.notes (#54322) next »