-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️Refactor: replace treePath with treePathHash in DefaultCtx to reduce memory usage #3368
Conversation
WalkthroughThe changes refactor how tree paths are managed across several modules by replacing string-based keys with integer-based keys throughout the routing stack. In the core application and router files, the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant D as DefaultCtx
participant A as App
participant TS as TreeStack
C->>D: Send Request
D->>D: Compute treePathHash from detectionPath
D->>A: Invoke route matching (next)
A->>TS: Retrieve routes using treePathHash
alt Key exists
TS-->>A: Return matching routes
else Fallback
A->>TS: Retrieve routes using fallback key 0
TS-->>A: Return fallback routes
end
A-->>D: Return matching result
D-->>C: Final Response
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3368 +/- ##
==========================================
- Coverage 83.71% 83.71% -0.01%
==========================================
Files 118 118
Lines 11722 11721 -1
==========================================
- Hits 9813 9812 -1
Misses 1482 1482
Partials 427 427
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
In the default context, the 3-byte-long
treePath
can be encoded as an int. Therefore, reduce the size ofDefaultCtx
andtreeStack
Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.