HTML: Improve diff display performance

This improves the diff performance by a factor of around 10. Things done
to do this are, among others:

	* user String.replace(//g) instead of String.gsub(). It's
		*much* faster
	* Don't use anonymous inner functions for iteration, but instead
		use for loops
	* Don't use String.startsWith() if we can just compare a
		single character

Because we are now so much faster, we can also show bigger diffs
by default.
This commit is contained in:
Pieter de Bie
2008-10-09 15:47:02 +02:00
parent 5c69f31b5a
commit 70bc282982
2 changed files with 51 additions and 44 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ var loadCommit = function() {
$("message").innerHTML = commit.message.replace(/\n/g,"<br>");
if (commit.diff.length < 10000) {
if (commit.diff.length < 200000) {
showDiffs();
} else {
$("details").innerHTML = "<a class='showdiff' href='' onclick='showDiffs(); return false;'>This is a large commit. Click here or press 'v' to view.</a>";