From 149f92896345b1fd873a814721b6e042a8681593 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 28 Nov 2006 16:34:28 +0000 Subject: 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 --- phpBB/includes/diff/diff.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/diff/diff.php') diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index ca8d16fd3e..59124ae7ef 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -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))); } /** -- cgit v1.2.1