Problem to Solve
The PathTrie (and hence Router) supports backtracking. You can override it per lookup with the optional backtrack flag, which default true.
But if back-tracking is ever needed is really a function of the registered paths/routes.
The user can choose wrong without knowing - either paying for backtracking when not needed, or fail lookup when backtracking would have found a match.
Proposal
Let PathTrie calculate a _needsBacktracking as paths are added, removed or sub-tries injected.
Use this in place of backtracking.
Use Case
Simplifies the interface for the enduser without leaving performance on the table.
Alternatives
Live with current situation.
Additional context
No response
How experienced are you with this library?
Expert - Experienced and comfortable with using this library in complex projects
Are you interested in working on a PR for this?
Problem to Solve
The
PathTrie(and henceRouter) supports backtracking. You can override it perlookupwith the optionalbacktrackflag, which defaulttrue.But if back-tracking is ever needed is really a function of the registered paths/routes.
The user can choose wrong without knowing - either paying for backtracking when not needed, or fail lookup when backtracking would have found a match.
Proposal
Let
PathTriecalculate a_needsBacktrackingas paths are added, removed or sub-tries injected.Use this in place of
backtracking.Use Case
Simplifies the interface for the enduser without leaving performance on the table.
Alternatives
Live with current situation.
Additional context
No response
How experienced are you with this library?
Expert - Experienced and comfortable with using this library in complex projects
Are you interested in working on a PR for this?