mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-26 02:25:36 +00:00
type: cache CompoundType._member()
Parsing the member designator and walking the members is relatively expensive and can be in the hot path when iterating over lots of objects.
This commit is contained in:
parent
0089014fed
commit
2c0b63eda3
@ -14,6 +14,7 @@ help(Type).
|
||||
|
||||
from collections import OrderedDict
|
||||
import enum
|
||||
import functools
|
||||
import math
|
||||
import numbers
|
||||
import re
|
||||
@ -542,6 +543,7 @@ class CompoundType(Type):
|
||||
"""
|
||||
return list(self._members_by_name)
|
||||
|
||||
@functools.lru_cache()
|
||||
def _member(self, member: str) -> Tuple[Type, int]:
|
||||
designator = parse_member_designator(member)
|
||||
type_: Type = self
|
||||
|
Loading…
Reference in New Issue
Block a user