1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

begin working on getting this thing a bit faster. I need to finish the other calls, this commit actually will break the diff engine and the updater. The speed increase noticed is from 89 seconds to 22 seconds as well as saving a lot of memory.

git-svn-id: file:///svn/phpbb/trunk@6692 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-11-28 16:34:28 +00:00
parent ff2b4e4e8f
commit 149f928963
3 changed files with 55 additions and 16 deletions

View File

@@ -46,10 +46,17 @@ class diff
* @param array $from_lines An array of strings. Typically these are lines from a file.
* @param array $to_lines An array of strings.
*/
function diff($from_lines, $to_lines)
function diff(&$from_content, &$to_content)
{
$diff_engine = &new diff_engine();
$this->_edits = call_user_func_array(array($diff_engine, 'diff'), array($from_lines, $to_lines));
$match = array('#\r\n?#', "#([\n]+){2,}#u");
$replace = array("\n", "\n");
$from_content = preg_replace($match, $replace, $from_content);
$to_content = preg_replace($match, $replace, $to_content);
$this->_edits = call_user_func_array(array($diff_engine, 'diff'), array(explode("\n", $from_content), explode("\n", $to_content)));
}
/**