Skip to content

perf: try_rsgi_sync_short_circuit extracts String instead of borrowing &str #253

Closed

Description

@ZhuchkaTriplesix

Where: src/dispatch.rs:350-358 (try_rsgi_sync_short_circuit).

Currently:

let proto: String = scope.getattr("proto")?.extract()?;
let method: String = scope.getattr("method")?.extract()?;
let path: String = scope.getattr("path")?.extract()?;

On every incoming request entering try_rsgi_sync_short_circuit, three heap Strings are allocated, even for requests that 404, 405, or fall back to async.

Fix direction:
Extract borrowed &str directly without heap allocation:

let proto = scope.getattr("proto")?.extract::<&str>()?;
...
let method = scope.getattr("method")?.extract::<&str>()?;
let path = scope.getattr("path")?.extract::<&str>()?;

Activity

  1. added
    enhancement
    on Oct 18, 2026
  2. added a commit that references this issue on Oct 18, 2026
  3. ZhuchkaTriplesix commented on Oct 18, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Resolved in PR #260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions