From 005f82f0b183ec7c562362f992ee8c514c2d593e Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 10 Dec 2014 15:25:33 +0100 Subject: container.directory: filtering optimizations local variables have a better access time --- ranger/container/directory.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 6b9f054e..5b32300a 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -202,13 +202,16 @@ class Directory(FileSystemObject, Accumulator, Loadable): if not self.settings.show_hidden and self.settings.hidden_filter: hidden_filter = re.compile(self.settings.hidden_filter) - filters.append(lambda file: not hidden_filter.search(file.basename)) + hidden_filter_search = hidden_filter.search + filters.append(lambda file: not hidden_filter_search(file.basename)) if self.filter: - filters.append(lambda file: self.filter.search(file.basename)) + filter_search = self.filter.search + filters.append(lambda file: filter_search(file.basename)) if self.inode_type_filter: filters.append(self.inode_type_filter) if self.temporary_filter: - filters.append(lambda file: self.temporary_filter.search(file.basename)) + temporary_filter_search = self.temporary_filter_search + filters.append(lambda file: temporary_filter_search(file.basename)) self.files = [f for f in self.files_all if accept_file(f, filters)] self.move_to_obj(self.pointed_obj) -- cgit 1.4.1-2-gfad0