From ed51dd5d644428a838861c58cda220a21b1523a8 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 2 Nov 2010 05:41:46 +0000 Subject: [PATCH] Avoid an O(n**2) operation where O(n) will suffice. Possibly worth a second or two when running the test suite. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14433 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 25587a7526..5de0ac0a2f 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -631,8 +631,10 @@ class BaseDatabaseIntrospection(object): for model in models.get_models(app): if router.allow_syncdb(self.connection.alias, model): all_models.append(model) - return set([m for m in all_models - if self.table_name_converter(m._meta.db_table) in map(self.table_name_converter, tables) + tables = map(self.table_name_converter, tables) + return set([ + m for m in all_models + if self.table_name_converter(m._meta.db_table) in tables ]) def sequence_list(self):