[Pkg-mozext-commits] [firebug] 03/68: Issue 6256: Auto-completion is slow
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 22:45:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag fbtest-1.11.4
in repository firebug.
commit e2d30766175f87a372eb10474f30af323f257986
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date: Sat Feb 9 14:56:47 2013 +0100
Issue 6256: Auto-completion is slow
http://code.google.com/p/fbug/issues/detail?id=6256
---
extension/content/firebug/console/autoCompleter.js | 48 ++++++++++++++++++++--
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/extension/content/firebug/console/autoCompleter.js b/extension/content/firebug/console/autoCompleter.js
index 76a9dbb..51ccee3 100644
--- a/extension/content/firebug/console/autoCompleter.js
+++ b/extension/content/firebug/console/autoCompleter.js
@@ -1672,6 +1672,44 @@ function comparePropertyNames(lhs, rhs)
return (lhs === rhs ? 0 : 1);
}
+// See autoCompleteEval. This reorders a sorted array to look as if it had been
+// sorted by comparePropertyNames.
+function reorderPropertyNames(ar)
+{
+ var buckets = [];
+ for (var i = 0; i < ar.length; ++i)
+ {
+ var s = ar[i];
+ if (s.charAt(0) === "_")
+ {
+ var count = 0, j = 0;
+ while (count < s.length && s.charAt(count) === "_")
+ ++count;
+ --count;
+ if (!buckets[count])
+ buckets[count] = [];
+ buckets[count].push(s);
+ }
+ }
+
+ if (!buckets.length)
+ return ar;
+
+ var res = [];
+ for (var i = 0; i < ar.length; ++i)
+ {
+ if (ar[i].charAt(0) !== "_")
+ res.push(ar[i]);
+ }
+ for (var i = 0; i < buckets.length; ++i)
+ {
+ var ar2 = buckets[i];
+ if (ar2)
+ res.push.apply(res, ar2);
+ }
+ return res;
+}
+
function propertiesToHide(expr, obj)
{
var ret = [];
@@ -2233,10 +2271,12 @@ function autoCompleteEval(context, preExpr, spreExpr, includeCurrentScope)
}
// Sort the completions, and avoid duplicates.
- // XXX: If we make it possible to show both regular and hidden completions
- // at the same time, completions must shadow hiddenCompletions.
- out.completions = Arr.sortUnique(out.completions, comparePropertyNames);
- out.hiddenCompletions = Arr.sortUnique(out.hiddenCompletions, comparePropertyNames);
+ // Note: If we make it possible to show both regular and hidden completions
+ // at the same time, completions should shadow hiddenCompletions here.
+ // XXX Normally we'd just do sortUnique(completions, comparePropertyNames),
+ // but JSD makes that slow (issue 6256). Sort and do manual reordering instead.
+ out.completions = reorderPropertyNames(Arr.sortUnique(out.completions));
+ out.hiddenCompletions = reorderPropertyNames(Arr.sortUnique(out.hiddenCompletions));
}
catch (exc)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list