Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache GetClass results in ValueMapping, and ValueMapping objects #2305

Open
andy-maier opened this issue Jun 25, 2020 · 1 comment
Open

Cache GetClass results in ValueMapping, and ValueMapping objects #2305

andy-maier opened this issue Jun 25, 2020 · 1 comment

Comments

@andy-maier
Copy link
Contributor

andy-maier commented Jun 25, 2020

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.

@andy-maier andy-maier self-assigned this Jun 25, 2020
@andy-maier andy-maier added this to the 1.1.0 milestone Jun 25, 2020
@andy-maier andy-maier changed the title Cache GetClass results in ValueMapping Cache GetClass results in ValueMapping, and ValueMapping objects Jun 25, 2020
@andy-maier
Copy link
Contributor Author

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.

@andy-maier andy-maier removed this from the 1.1.0 milestone Aug 19, 2020
@andy-maier andy-maier added this to the 1.5.0 milestone Mar 1, 2022
@andy-maier andy-maier assigned KSchopmeyer and unassigned andy-maier Mar 1, 2022
@andy-maier andy-maier modified the milestones: 1.5.0, 1.6.0 Aug 2, 2022
@andy-maier andy-maier modified the milestones: 1.6.0, 1.7.0 Nov 29, 2022
@andy-maier andy-maier modified the milestones: 1.7.0, 1.8.0 May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants