[ 
https://issues.apache.org/jira/browse/DISPATCH-1642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123890#comment-17123890
 ] 

ASF subversion and git services commented on DISPATCH-1642:
-----------------------------------------------------------

Commit ee82acda5656ca0b5bb6ef86b9869f9ecfac1559 in qpid-dispatch's branch 
refs/heads/master from Ken Giusti
[ https://gitbox.apache.org/repos/asf?p=qpid-dispatch.git;h=ee82acd ]

DISPATCH-1642: Change parse tree insert to fail on duplicate entry


> 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
>            Assignee: Ken Giusti
>            Priority: Minor
>             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: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to