You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current pywbem.ValueMapping imlementation gets the required class every time a new ValueMapping object is created. This creates unnecessary repeated GetClass operations for the same class in the following typical usage pattern (as used e.g. in pywbemtools in its upcoming ValueMapping support):
insts = conn.EnumerateInstances("CIM_Foo")
for inst in insts:
for prop in inst.properties:
if ... # property is integer typed:
prop_vm = ValueMapping.for_property(prop) # calls GetClass("CIM_Foo")
Even when that loop caches the resulting ValueMapping objects (as done in the pywbemtools support), there are still unnecessary repeated calls to GetClass("CIM_Foo") for each separate property of the instances.
A solution could be to implement a class cache in ValueMapping.
That could be extended to cache the ValueMapping objects as well, since they are not mutable. That would allow pywbemtools or similar users with a loop like the above not having to implement a ValueMapping object cache.
The text was updated successfully, but these errors were encountered:
An additional consideration is whether the caching should be done at a level like for example the WBEM operations. Needs to be figured out before working on this issue.
The current
pywbem.ValueMapping
imlementation gets the required class every time a new ValueMapping object is created. This creates unnecessary repeated GetClass operations for the same class in the following typical usage pattern (as used e.g. in pywbemtools in its upcoming ValueMapping support):Even when that loop caches the resulting ValueMapping objects (as done in the pywbemtools support), there are still unnecessary repeated calls to GetClass("CIM_Foo") for each separate property of the instances.
A solution could be to implement a class cache in ValueMapping.
That could be extended to cache the ValueMapping objects as well, since they are not mutable. That would allow pywbemtools or similar users with a loop like the above not having to implement a ValueMapping object cache.
The text was updated successfully, but these errors were encountered: