From fb1bbb8aa5b1b5f60ecd055ee944b2ffefc22d5a Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 17 Apr 2019 03:42:17 +0200 Subject: menuconfig: Micro-optimize incremental search removing the matches.append lookup saves a few %, as measured with line_profiler. It's fast enough already on any reasonable machine, so it's a bit silly, but it's pretty trivial. --- menuconfig.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'menuconfig.py') diff --git a/menuconfig.py b/menuconfig.py index cde401e..737ee95 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -2019,6 +2019,7 @@ def _jump_to_dialog(): # List of matching nodes matches = [] + add_match = matches.append # Search symbols and choices @@ -2041,7 +2042,7 @@ def _jump_to_dialog(): break else: - matches.append(node) + add_match(node) # Search menus and comments @@ -2050,7 +2051,7 @@ def _jump_to_dialog(): if not search(node.prompt[0].lower()): break else: - matches.append(node) + add_match(node) except re.error as e: # Bad regex. Remember the error message so we can show it. -- cgit v1.2.3