coredata: remove get_builtin_options

This returns a list out of th keys of a dict. In both cases of use
remaining though it's used for checking membership, checking for list
membership, lists are O(n) lookup, while dicts are O(1), so removing
the abstraction reduces typing and improves performance.
pull/4931/head
Dylan Baker 6 years ago
parent d778a371ac
commit c6060d795c
  1. 7
      mesonbuild/coredata.py
  2. 2
      mesonbuild/optinterpreter.py

@ -508,7 +508,7 @@ class CoreData:
if subproject:
if not k.startswith(subproject + ':'):
continue
elif k not in get_builtin_options():
elif k not in builtin_options:
if ':' in k:
continue
if optinterpreter.is_invalid_name(k):
@ -654,11 +654,8 @@ def save(obj, build_dir):
os.replace(tempfilename, filename)
return filename
def get_builtin_options():
return list(builtin_options.keys())
def is_builtin_option(optname):
return optname in get_builtin_options()
return optname in builtin_options
def get_builtin_option_choices(optname):
if is_builtin_option(optname):

@ -20,7 +20,7 @@ from . import coredata
from . import mesonlib
from . import compilers
forbidden_option_names = coredata.get_builtin_options()
forbidden_option_names = set(coredata.builtin_options.keys())
forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
reserved_prefixes = ['cross_']

Loading…
Cancel
Save