feat!: Use a radix trie for route matching - #628
Draft
ElijahAhianyo wants to merge 10 commits into
Draft
Conversation
|
| Project | cot |
| Branch | elijah/router-trie |
| Testbed | github-ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| empty_router/empty_router | 📈 view plot 🚷 view threshold | 13,382.00 µs(+58.48%)Baseline: 8,443.74 µs | 15,967.65 µs (83.81%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,106.50 µs(+5.19%)Baseline: 1,051.95 µs | 1,375.40 µs (80.45%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 1,069.90 µs(+8.72%)Baseline: 984.08 µs | 1,259.95 µs (84.92%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 998.97 µs(+5.42%)Baseline: 947.61 µs | 1,222.55 µs (81.71%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 16,787.00 µs(-1.81%)Baseline: 17,096.03 µs | 21,569.36 µs (77.83%) |
Contributor
Author
|
Should be rebased on and merged after #586 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The current router implementation uses a
Vecto store routers, which has some real limitations. For example, using a vec meant route conflict detection was cumbersome and hacky to get right. Using a Radix trie is the right data structure for this problem. This PR delegates the core Trie logic to the matchit crate. We still keep our business logic in a light wrapper over the Matchit Router.Breaking Changes
url_prefixwill failType of change