Category:Core -> Optimize
This page will keep track of all Regex improvements. Once the code improvement has been added, it will be marked as Added. If you get a chance, go through as many approvements as possible and approve it or don’t approve it. Keep in mind CodeIgniter’s goals (meaning don’t write improvements that won’t work everywhere). If a code improvement gets a lot of “Not Approved”, it will probably be dropped from this page.
DO NOT EDIT SUBMITTED CODE. IF YOU THINK OF A BETTER IMPROVEMENT, MARK THE CURRENT CODE AS “NOT APPROVED” AND SUBMIT YOUR OWN.
****************************************************************************************************
NOT ADDED system/helpers/string_helper.php - line 70
****************************************************************************************************
SUGGESTED BY: Geert De Deckere
****************************************************************************************************
APPROVED BY:
****************************************************************************************************
NOT APPROVED BY:
****************************************************************************************************
BEFORE: 10000 iterations take about 0.0873 seconds
function reduce_double_slashes($str)
{
return preg_replace("#([^:])//+#", "\\1/", $str);
}
AFTER: 10000 iterations take about 0.0429 seconds
function reduce_double_slashes($str)
{
return preg_replace('#(?<!:)//+#', '/', $str); // twice as fast, woot!
}
****************************************************************************************************
Just copy and paste the template below to add your own addition.
****************************************************************************************************
NOT ADDED system/REPLACE/REPLACE.php - line ??
****************************************************************************************************
SUGGESTED BY:
****************************************************************************************************
APPROVED BY:
****************************************************************************************************
NOT APPROVED BY:
****************************************************************************************************
BEFORE:
//put the original code here
AFTER:
//put the replaced code here
****************************************************************************************************
