diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-04-24 09:42:33 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-28 22:42:39 +0300 |
commit | 6944d06116bf3ed691faf991dbfa0478c8c2d345 (patch) | |
tree | 819625a2a51e380cf3bfd8a0074d17789a17834d /mesonbuild/mesonlib.py | |
parent | 9635d0bd69e14e1647aae61b254e3848150dfbae (diff) | |
download | meson-6944d06116bf3ed691faf991dbfa0478c8c2d345.zip meson-6944d06116bf3ed691faf991dbfa0478c8c2d345.tar.gz meson-6944d06116bf3ed691faf991dbfa0478c8c2d345.tar.bz2 |
Don't use dict.keys() to check membership
It's much faster to do 'if a in dict' instead of 'if a in dict.keys()',
since the latter constructs an iterator and walks that iterator and then
tests equality at each step, and the former does a single hash lookup.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 0263768..fbd732a 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -371,7 +371,7 @@ def do_replacement(regex, line, confdata): match = re.search(regex, line) while match: varname = match.group(1) - if varname in confdata.keys(): + if varname in confdata: (var, desc) = confdata.get(varname) if isinstance(var, str): pass |