intel/genxml: use a set for lookups

Python will pre-compute the set since it's const, and the performance of
a set search is significantly better than that of a list search

Reviewd-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18917>
This commit is contained in:
Dylan Baker
2022-09-30 10:59:15 -07:00
parent e04ece53d7
commit f286451ada

View File

@@ -21,19 +21,19 @@ def get_start(element):
return int(element.attrib['start'], 0)
base_types = [
BASE_TYPES = {
'address',
'offset',
'int',
'uint',
'bool',
'float',
]
}
FIXED_PATTERN = re.compile(r"(s|u)(\d+)\.(\d+)")
def is_base_type(name):
return name in base_types or FIXED_PATTERN.match(name)
return name in BASE_TYPES or FIXED_PATTERN.match(name)
def add_struct_refs(items, node):
if node.tag == 'field':