Title: [100505] trunk/Tools
- Revision
- 100505
- Author
- [email protected]
- Date
- 2011-11-16 14:24:00 -0800 (Wed, 16 Nov 2011)
Log Message
contributors_by_fuzzy_match is super slow
https://bugs.webkit.org/show_bug.cgi?id=72540
Reviewed by Eric Seidel.
Make contributors_by_name do case insensitive search using a dictionary.
Also call contributors_by_name first in contributors_by_fuzzy_match now that it's fast
because that's the most common case.
* Scripts/webkitpy/common/config/committers.py:
* Scripts/webkitpy/common/config/committers_unittest.py:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (100504 => 100505)
--- trunk/Tools/ChangeLog 2011-11-16 22:21:50 UTC (rev 100504)
+++ trunk/Tools/ChangeLog 2011-11-16 22:24:00 UTC (rev 100505)
@@ -1,3 +1,18 @@
+2011-11-16 Ryosuke Niwa <[email protected]>
+
+ contributors_by_fuzzy_match is super slow
+ https://bugs.webkit.org/show_bug.cgi?id=72540
+
+ Reviewed by Eric Seidel.
+
+ Make contributors_by_name do case insensitive search using a dictionary.
+
+ Also call contributors_by_name first in contributors_by_fuzzy_match now that it's fast
+ because that's the most common case.
+
+ * Scripts/webkitpy/common/config/committers.py:
+ * Scripts/webkitpy/common/config/committers_unittest.py:
+
2011-11-16 David Levin <[email protected]>
check-webkit-style should recognize functions even if they have OVERRIDE after them.
Modified: trunk/Tools/Scripts/webkitpy/common/config/committers.py (100504 => 100505)
--- trunk/Tools/Scripts/webkitpy/common/config/committers.py 2011-11-16 22:21:50 UTC (rev 100504)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers.py 2011-11-16 22:24:00 UTC (rev 100505)
@@ -462,6 +462,7 @@
self._contributors = contributors + committers + reviewers
self._committers = committers + reviewers
self._reviewers = reviewers
+ self._contributors_by_name = {}
self._accounts_by_email = {}
self._accounts_by_login = {}
@@ -477,6 +478,14 @@
def reviewers(self):
return self._reviewers
+ def _name_to_contributor_map(self):
+ if not len(self._contributors_by_name):
+ for contributor in self._contributors:
+ assert(contributor.full_name)
+ assert(contributor.full_name.lower() not in self._contributors_by_name) # We should never have duplicate names.
+ self._contributors_by_name[contributor.full_name.lower()] = contributor
+ return self._contributors_by_name
+
def _email_to_account_map(self):
if not len(self._accounts_by_email):
for account in self._accounts:
@@ -509,13 +518,6 @@
return None
return record
- def contributor_by_name(self, name):
- # This could be made into a hash lookup if callers need it to be fast.
- for contributor in self.contributors():
- if contributor.full_name and contributor.full_name == name:
- return contributor
- return None
-
def committer_by_name(self, name):
return self._committer_only(self.contributor_by_name(name))
@@ -540,7 +542,7 @@
string = string.lower()
# First path, optimitically match for fullname, email and irc_nicknames
- account = self.account_by_email(string) or self.contributor_by_irc_nickname(string) or self.contributor_by_name(string)
+ account = self.contributor_by_name(string) or self.account_by_email(string) or self.contributor_by_irc_nickname(string)
if account:
return [account], 0
@@ -568,6 +570,9 @@
def account_by_email(self, email):
return self._email_to_account_map().get(email.lower())
+ def contributor_by_name(self, name):
+ return self._name_to_contributor_map().get(name.lower())
+
def contributor_by_email(self, email):
return self._contributor_only(self.account_by_email(email))
Modified: trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py (100504 => 100505)
--- trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2011-11-16 22:21:50 UTC (rev 100504)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2011-11-16 22:24:00 UTC (rev 100505)
@@ -52,6 +52,9 @@
self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
self.assertEqual(committer_list.committer_by_name("Test Three"), None)
self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)
+ self.assertEqual(committer_list.contributor_by_name("test one"), committer)
+ self.assertEqual(committer_list.contributor_by_name("test two"), reviewer)
+ self.assertEqual(committer_list.contributor_by_name("test three"), contributor)
# Test that the first email is assumed to be the Bugzilla email address (for now)
self.assertEqual(committer_list.committer_by_email('[email protected]').bugzilla_email(), '[email protected]')
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes