summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-05 04:43:06 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-05 04:54:10 +0200
commit121d4a95ed0cd6cf64d64b92eedfb163a531d672 (patch)
tree15f429b11ced1ea75c6d318c8444d47147cb35c9 /kconfiglib.py
parent0b9e3b0c701f0bc5de23680a55ecfdd142f09f51 (diff)
Improve tokenization performance by removing a single character.
strip() instead of lstrip() makes the loop terminate earlier, saving lots of calls. Shaves a few % of parsing the x86 Kconfigs.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index fbeaad5..4679126 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -614,7 +614,11 @@ class Config(object):
for_eval -- True when parsing an expression for a call to
Config.eval(), in which case we should not treat the first
token specially nor register new symbols."""
- s = s.lstrip()
+
+ # lstrip() would work here too, but removing the '\n' at the end leads
+ # to earlier termination in the 'while' loop below, saving lots of
+ # calls
+ s = s.strip()
if s == "" or s[0] == "#":
return _Feed([])