client class erase concern
#1139 (closed) introduced a new client class method erase. I have some concerns about its use:
- first it supposes built-in or added by hook classes are never defined: this is in general true but nothing prevents someone to define a class added by a hook or a built-in class
- second performance can be very bad: complexity is x
I found some ways to improve the performance and in some cases to fix the first concern too:
- move to a boost multi-index: the problem is with the list part (linear), in a multi-index the interesting node can be found using the unordered set index (logarithm). Note this can be applied to the ClientClasses or the ClientClassDictionary or both.
- if I understand well the code the problem is with member predicates: we can add a flag in definitions when the test expression uses a member predicate. Note we do this in test expression parsing to check if the member predicate refers to an already defined or built-in class so this is a small change: keep the condition in a new field.
- swap the query classes and the definition dictionary in the iteration.