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/environment.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/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index d3be926..b0ba78d 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -819,7 +819,7 @@ def get_args_from_envvars(compiler): if hasattr(compiler, 'get_linker_exelist'): compiler_is_linker = (compiler.get_exelist() == compiler.get_linker_exelist()) - if lang not in cflags_mapping.keys(): + if lang not in cflags_mapping: return [], [], [] compile_flags = os.environ.get(cflags_mapping[lang], '') |