-
-
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: reduce DefaultCtx from 768 bytes to 736 bytes #3353
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request refactors the handling of HTTP paths by updating the Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant Ctx as DefaultCtx
participant Utils
participant Match as match()
App->>Ctx: Process request context
Ctx-->>App: Return modified path via getString()
App->>Utils: Convert c.detectionPath to UnsafeString
App->>Utils: Convert c.path to UnsafeString
App->>Match: Call match(UnsafeString(detectionPath), UnsafeString(path))
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🪧 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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3353 +/- ##
==========================================
- Coverage 83.61% 83.60% -0.02%
==========================================
Files 118 118
Lines 11727 11719 -8
==========================================
- Hits 9806 9798 -8
Misses 1491 1491
Partials 430 430
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one comment.
|
||
// Define the path for dividing routes into areas for fast tree detection, so that fewer routes need to be traversed, | ||
// since the first three characters area select a list of routes | ||
c.treePath = c.treePath[0:0] | ||
c.treePath = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why replace c.treePath[:0] here?
Description
In the default context,
pathBuffer
anddetectionPathBuffer
can be used aspath
anddetectionPath
directly. We can remove twostring
fields and save32 bytes
for each context.Type of change
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.