Shreemanarjun / Shreemanarjun/nitro_server
perf: Router::match should return a pointer, not copy RouteEntry
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Problem
Router::match copies the matched RouteEntry (method, pattern strings, flags) into the MatchResult on every request. On the hot path this is an avoidable allocation/copy per request.
Proposal
Return a const RouteEntry* into the trie node instead of copying, since the router outlives the match on the request path (routes only change under the config lock). Keep the params vector as-is. Small, self-contained; covered by test/cpp/router_test.cpp.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Router::match and the MatchResult/RouteEntry definitions, then read test/cpp/router_test.cpp to understand the existing expectations. Confirm the matched entry is referenced rather than copied while the params vector remains unchanged, and run the router tests to verify the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100