Skip to content

perf(dispatch): borrow &str instead of allocating String in try_rsgi_sync_short_circuit (#253) - #260

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue-253-sync-short-circuit-borrow-str
Oct 18, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue-253-sync-short-circuit-borrow-str

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #253

Summary of Changes

  • In try_rsgi_sync_short_circuit (src/dispatch.rs):
    • Previously, proto, method, and path were extracted as owned Strings via extract::<String>()?, allocating 3 heap strings on every request that entered the dispatch pipeline.
    • Replaced with direct &str borrowing (extract::<&str>()?) bound to local Python object references.
    • Replaced redundant &method and &path ref-of-ref parameters with direct method and path &str slices when matching routes and sending error responses.
  • Verified formatting (cargo fmt), clippy (cargo clippy), unit tests (37 Rust unit tests), and pytest suite (39 targeted tests).

@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit a95cb0d into dev Oct 18, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant