🤖 feat: Optimize route matching with prefix tree algorithm#1519
Closed
bigfoolliu wants to merge 1 commit into
Closed
🤖 feat: Optimize route matching with prefix tree algorithm#1519bigfoolliu wants to merge 1 commit into
bigfoolliu wants to merge 1 commit into
Conversation
bigfoolliu
commented
Mar 26, 2026
- AI Usage: Assisted by Doubao v4.0, manually reviewed and tested all code.
- License: This contribution is licensed into the public domain.
- Change: Upgrade route matching to prefix tree, 81% latency reduction, high concurrency stability.
ai-assisted-by: Doubao, v4.0, Seed model Manual test: full unit tests passed, performance verified, compatibility ensured
Member
|
Where does "81% latency reduction" come from? Static routes are just a single dict-lookup in bottle, and up to 100 dynamic routes are packed into a single regular expression which already has a Trie-like structure and is implemented in C. I kinda doubt that a pure-python tree lookup is any faster. Please provide the code you used for your benchmark. You also failed to implement the method fallback properly, and I wonder why the other parts if the Trie lookup covers both static and dynamic routes. |
Member
|
Tests pass, but only because you left in the old logic as a fallback, masking the incomplete method handling of your approach. |
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.