Ken Giusti created DISPATCH-1642:
------------------------------------

             Summary: Avoid extra search when adding address configs to parse 
tree
                 Key: DISPATCH-1642
                 URL: https://issues.apache.org/jira/browse/DISPATCH-1642
             Project: Qpid Dispatch
          Issue Type: Improvement
          Components: Router Node
    Affects Versions: 1.12.0
            Reporter: Ken Giusti
             Fix For: Backlog


Configured address patterns are stored in a parse tree.  When new addresses are 
created the code first searches the parse tree to see if the address already 
exists in order to avoid adding duplicate addresses.   If there is no duplicate 
the code then calls the parse tree insertion function.

This is sub-optimal.  The likely case is that the address does not exist in the 
parse tree.  This means the first search (for duplication) will result in 
searching the entire tree, which devolves to O(n).

Currently the parse tree insertion code resolves duplication by replacing the 
existing node's data with the new data.  If instead we treated this as a 
duplication error and avoided the insertion we could avoid the extra lookup and 
just let the insertion code do the duplication check for us (single pass).

This lookup then insert pattern is used in agent_config_address.c and 
route_control.c.  Search for calls to qd_parse_tree_get_pattern().

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to