Details
-
Improvement
-
Status: Resolved
-
Resolution: Won't Do
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
Description
Presently, the only code generated by yangtools for objects is equals().
This limits the possible scalable lookup methods for storing large number of objects to HashMap() and derivatives.
There is a number of key areas where hashmap is known to be the wrong answer - v4 prefixes and routing tables, large numbers of tunnels, etc. These are better services by a variety of a Tree (f.e. B tree).
Trees require a comparator which returns less, equal, more in order to be implemented. This is missing.
Proposal:
In addition to the current equals() to have a compare() method which by default returns the lexical compare of the string representation.
If overrides and optimizations are implemented (f.e. for prefixes and ip addresses), more appropriate comparators can be implemented. Example - taking the prefix length into account when comparing prefixes so they can be arranged into a tree for a fast longest prefix match.