[YANGTOOLS-741] Improve a substatement context lookup in yang statement parser Created: 02/Feb/17  Updated: 30/Oct/20  Resolved: 12/Jun/18

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Highest
Reporter: Peter Kajsa Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Epic Link: Parser Performance

 Description   

Very often we need to check whether a substatement with a specific statement definition exists under some statement context in yang statement parser or to look up a substatement (or substatements) with a specific statement definition.

Currently, in order to do that we need to iterate over all current context's substatements and check whether there is a substatement we are looking for.

I think using a MultiMap keyed by StatementDefinition instead of List for substatement contexts will improve these lookups significantly.



 Comments   
Comment by Robert Varga [ 05/Mar/17 ]

Nitrogen planning has not begun, hence de-targetting this one.

Comment by Robert Varga [ 24/Aug/17 ]

We cannot use MultiMap, as we need to retain order of definition (hence substatements needs to still be indexed using an integer). It could be a secondary index, but we need to solve YANGTOOLS-694 otherwise our memory usage will explode.

A further thought, though: we need a detailed analysis of what is the actual iteration cost, since I suspect most of the time we have only a few substatements – hence linear lookups are not that bad.

Comment by Robert Varga [ 12/Jun/18 ]

I don't think this is really needed.

Generated at Wed Feb 07 20:54:10 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.