summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-04-17 03:42:17 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2019-04-17 03:45:08 +0200
commitfb1bbb8aa5b1b5f60ecd055ee944b2ffefc22d5a (patch)
tree45361bfff21e98aa784f09b02adcf1dba02e2c3a
parent899bc77d837e9a2098449bd104bc640d99619194 (diff)
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.
-rwxr-xr-xmenuconfig.py5
1 files changed, 3 insertions, 2 deletions
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.